Should You Use a Notification or a Mailable?

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.พ. 2025
  • There's more than one way to send emails in Laravel. So should you always use a Mailable? Or what's a Notification? Should you use that even if you're just ending emails?
    Well... it depends. :) So why don't we take a look at why you might want to use one over the other and then you and your team can decide which is best to use for your particular use-case.
    Links:
    Mail Docs: laravel.com/do...
    Notification Docs: laravel.com/do...

ความคิดเห็น • 40

  • @filon861
    @filon861 4 หลายเดือนก่อน +3

    Thank you. Great content as always. One thing I'd probably include on the notification email is the meetup name so such cases where a user (organizer) has multiple meetups would know which of them a new registrant has signed up for.

  • @bhaidar
    @bhaidar 4 หลายเดือนก่อน +2

    Very nice video Josh, as usual. In general, I prefer using Notification as it allows me to send a notification via different methods. One nice thing about Notifications too is the ability to send on-demand notifications for "non-registered-users", hence functioning similar to how a Mailable work. Thanks

  • @mohamednafil8983
    @mohamednafil8983 4 หลายเดือนก่อน +10

    I had the same confusion. Thanks for your explanation

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +6

      I did too! That's why I made the video. It always helps clear things up for me when I have to learn it enough to share it with someone else. :)
      -Josh

  • @kyledoesdev
    @kyledoesdev 4 หลายเดือนก่อน +1

    Hey i really enjoyed this video. I personally always reach for notifications rather than mailables. It's a habit I developed from my job but carried over into my personal projects.

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +3

      Thanks for watching Kyle! Yeah, I didn't even know for the longest time that notifications could be emails too, but now I'm reaching for them more and more. :)
      -Josh

    • @kyledoesdev
      @kyledoesdev 4 หลายเดือนก่อน +1

      @@LaravelPHP sweet! Theyre super powerful, love em!

  • @MarkSnape
    @MarkSnape 4 หลายเดือนก่อน

    at the end you said it comes down to your personal preference, but a common scenario is giving the user the choice of how they want to receive the notification. So the user could manage their preferences and say, notify me by email, by text, or a daily digest (for example), or all three. Notifications handles all this so if you chose mailable initially, you would need to convert it over.

  • @jebiboy
    @jebiboy 4 หลายเดือนก่อน +2

    Oh this just cleared my confusion when to use notification and mailable. Thank you so much. Btw, what app are you using when viewing the delivered sample notifications/mails?

    • @SiddharthPant
      @SiddharthPant 3 หลายเดือนก่อน

      I think he must be using Herd's mail feature. But that's a paid feature. For free alternatives, you can look for Mailpit or even Laravel's Telescope has a mail UI.

  • @unTanana
    @unTanana 2 หลายเดือนก่อน

    Hey, is this vscode that you are using? If yes, how did you make it look so pretty? Especially the files finder :D

  • @smokeyoak
    @smokeyoak 4 หลายเดือนก่อน

    This is relevant to my interests.

  • @vitalikartsivadze
    @vitalikartsivadze 4 หลายเดือนก่อน

    Hi, nice comparison. What's the name of the extension telling who and when updated a specific part of the code?
    Cheers 🎉

  • @orpheusohms
    @orpheusohms 3 หลายเดือนก่อน

    Use Mailables within your notification. Mailables allow for more advanced configuration and templating.

  • @jacobdelcroix
    @jacobdelcroix 4 หลายเดือนก่อน +1

    Great explanation, thanks. Btw what’s your theme and font? Looks nice!

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +3

      Thanks for watching! It's the Catppuccin Frappe theme and Dank Mono font.
      -Josh

  • @kouceylahadji
    @kouceylahadji 4 หลายเดือนก่อน

    Personally when I just need to send email I use email, you have more flexibility(Multiple receivers, add cc, bcc and more...)
    Notification is good when you can for example to show the user list of notifications(using DB), send SMS or slack message

  • @TrondHus
    @TrondHus 4 หลายเดือนก่อน

    You could probably send a notification when the user (for instance the admin of the meetup you used as an example) is logged in. If he/She is not logged in, then you send an e-mail.

  • @hcivelek
    @hcivelek 4 หลายเดือนก่อน +1

    Thank you! Very clear..

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +2

      Thanks for watching! :)
      -Josh

  • @helderneves91
    @helderneves91 4 หลายเดือนก่อน

    Good content Josh!

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +1

      Thank you for watching! :)
      -Josh

  • @kmbo_0
    @kmbo_0 4 หลายเดือนก่อน

    I use both as well but didn't had the clarification on which to use when, thanks for explaining.
    Also, which IDE & extensions are you using in video?

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +2

      Hey there! Thanks for watching and glad that it could be helpful in explaining it. :)
      This is VSCode with the TALL Stack plugin pack and PHP Intelephense (can't wait for the VSCode Laravel plugin).
      -Josh

  • @DevNightly
    @DevNightly 4 หลายเดือนก่อน +1

    Hi! I have to ask, what is your keybaord switch? Sounds creamy.

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +3

      Don't tell anybody, but it's actually an artificial keyboard sound. 🫣
      It's an app called Klack.
      -Josh

    • @colin_cameron
      @colin_cameron 4 หลายเดือนก่อน +1

      @@LaravelPHP can you avoid this for future videos, or at least turn the volume down? I had to stop the video as the sound was making me feel uneasy.

  • @talisfang
    @talisfang 4 หลายเดือนก่อน

    What is the font in the IDE?

  • @victorvanrijn
    @victorvanrijn 4 หลายเดือนก่อน +3

    Great tutorial videos, thanks. Could you please try to normalize or master your voice audio track in your future videos, because it currently sounds relatively soft, which requires some extra focus and volume to clearly understand your explanation. Nothing wrong with your content or attitude, thanks again for these Laravel related tutorials!

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +1

      Hey there, I'll try to do better at fixing this in the future. I haven't gotten too many comments about it since some of the older videos weren't as good, but I'll try to keep an eye on it!
      -Josh

    • @pookiepats
      @pookiepats 4 หลายเดือนก่อน +1

      @@LaravelPHPit’s just how you speak, you tend to drop your vocal inflection at the end of your sentences and interestingly when you look away from the camera but frankly it’s quite subtle and likely the original commenter’s hardware is more to blame than anything you’re doing.
      It’s definitely deep in the nitpick zone 😂
      Nice vid sir

    • @StrahilMinev
      @StrahilMinev 4 หลายเดือนก่อน +1

      I don't want to sound like I invalidate your experience, but I find his voice very pleasant. Usually streamers talk too loud for my taste and his voice here I find very calming.

  • @anishshortsvideo19
    @anishshortsvideo19 4 หลายเดือนก่อน

    Thank you

    • @LaravelPHP
      @LaravelPHP  4 หลายเดือนก่อน +1

      Thanks for watching!
      -Josh

  • @onlinetechnology5015
    @onlinetechnology5015 4 หลายเดือนก่อน

    your vs code? font? family

  • @MarkConstable
    @MarkConstable 3 หลายเดือนก่อน

    I can't watch this at x1.5+ speed because of the background music! Please do not use music after the intro.

  • @parijke
    @parijke 4 หลายเดือนก่อน +9

    Nice video... Especially after 1 minute when the background "music" finally stopped. Don't use music when you talk please

    • @elijahcruz8895
      @elijahcruz8895 4 หลายเดือนก่อน +1

      Nothing wrong with having music in a video

    • @parijke
      @parijke 4 หลายเดือนก่อน +1

      @@elijahcruz8895 when you have misophonia it is really annoying almost intolerable.