Skip to content

Episode 25: Adding Notifications & LaraFlash

Latest

Choose a tag to compare

@jacurtis jacurtis released this 20 Nov 02:30

In this video we add the LaraFlash package to more easily manage our flash notifications. This powerful plugin allows us to easily add flash notifications to our Laravel app, including attaching additional information like priority, message type (success, info, danger, warning, snackbar, etc), and titles. You can add as many LaraFlash notifications to the same request as you want and they will all be available to use in the view. There are even powerful methods to sort the messages by priority or type.

Once LaraFlash is set up, then we set up our javascript notifications through Vue. We will do this by creating a new Notifications Vue.js object to manage all our notifications and set up the "mount" method to run all our LaraFlash notifications upon load.

Once all the notifications run, we can also trigger custom client-side notifications at any time by calling the notification methods such as .toast(), .success() and so forth.

At the end, we tie into the "copied" event that is triggered when our slug is copied to the clipboard and we show a notification with custom information about the copy request.

LaraFlash Laravel Package
https://github.com/DevMarketer/LaraFlash

Get Code Snippet for Toast.Blade.php:
https://gist.github.com/jacurtis/9fa687e8f7512bb197decce7ffc30091


Watch the Video:
https://youtu.be/649FIe_SD-o