Should You Use a Notification or a Mailable?
ฝัง
- เผยแพร่เมื่อ 18 พ.ย. 2024
- 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... - วิทยาศาสตร์และเทคโนโลยี
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.
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
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.
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
@@LaravelPHP sweet! Theyre super powerful, love em!
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.
I had the same confusion. Thanks for your explanation
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
Use Mailables within your notification. Mailables allow for more advanced configuration and templating.
Hi, nice comparison. What's the name of the extension telling who and when updated a specific part of the code?
Cheers 🎉
Hey, is this vscode that you are using? If yes, how did you make it look so pretty? Especially the files finder :D
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?
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.
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.
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
This is relevant to my interests.
Great explanation, thanks. Btw what’s your theme and font? Looks nice!
Thanks for watching! It's the Catppuccin Frappe theme and Dank Mono font.
-Josh
Hi! I have to ask, what is your keybaord switch? Sounds creamy.
Don't tell anybody, but it's actually an artificial keyboard sound. 🫣
It's an app called Klack.
-Josh
@@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.
Good content Josh!
Thank you for watching! :)
-Josh
Thank you! Very clear..
Thanks for watching! :)
-Josh
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?
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
What is the font in the IDE?
Thank you
Thanks for watching!
-Josh
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!
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
@@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
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.
your vs code? font? family
Nice video... Especially after 1 minute when the background "music" finally stopped. Don't use music when you talk please
Nothing wrong with having music in a video
@@elijahcruz8895 when you have misophonia it is really annoying almost intolerable.
I can't watch this at x1.5+ speed because of the background music! Please do not use music after the intro.