Some months ago, I needed to add some kind of alerts from the backend to the frontend, like “Your Podcast #4 is being processed and will be available shortly”. As you may know, doing this is not very expressive since there are no mechanisms in place to do that.
The usual dev would flash that message into the session, and then rescue that in the view. This works well, until you need to manage something more than a message, like its presentational state, or dynamically add more than one alert from different parts of the application.
So I decided to make a package to deal with these fallouts.
Making alerts, one at a time
Well, it’s not a miracle per-se, but since making alerts became very cumbersome to me:
Quickly set one or multiple Alerts in your backend, and render them in the frontend. Laralerts is compatible with any…
I made this package to avoid just that. Instead of pushing something from the backend in a very-verbose-way, I just add an expressive one-liner. It’s compatible with Bootstrap 4, but is framework-agnostic since it has a view you can override with your own HTML.
I like things working out-of-the-box and I think this accomplishes that. Just after installing the package you can go straight to deal with your Alerts. For example, let’s say we need to add two in the controller. No problem:
public function upload(Request $request)
'podcast' => 'mimetypes:audio/mp3'
]); $podcast = Podcast::parse($request->podcast); alert_if($podcast->length > 30, trans('podcast.large')
->warning(); alert()->lang('podcast.uploaded', ['podcast' => $podcast])
->success(); return view('podcast.uploaded', [
'podcast' => $podcast,
And also, if you like Bootstrap 4 toast notifications, you can edit the HTML used to render the alerts. I personally don’t use toast notifications except for when you’re using some kind of real-time functionality were you don’t need to refresh the page.
Give it a chance and tell me what do you think.