Friday, April 19, 2024
HomePHPConsumer Notifications in Livewire with Megaphone

Consumer Notifications in Livewire with Megaphone


Megaphone is a Livewire UI for Laravel-based person notifications. It makes use of built-in Laravel notification options to help you add bell icons to your Livewire app:

1use MBarlowMegaphoneTypesImportant;

2use AppModelsUser;

3 

4$notification = new Necessary(

5 // Notification Title

6 'Anticipated Downtime!',

7 // Notification Physique

8 'We expect some downtime right now at round 15:00 UTC for some deliberate upkeep. Learn extra on a weblog put up!',

9 'https://instance.com/hyperlink', // Non-compulsory

10 'Learn Extra...' // Non-compulsory

11);

12 

13$person->notify($notification);

Utilizing the above code, you possibly can render notifications in your app utilizing the supplied Blade part:

1<livewire:megaphone></livewire:megaphone>

This package deal has different neat options to handle notifications and ship them en masse to customers:

  • Customized notification sorts
  • Command to clear bulletins
  • Customizable record of notification sorts within the admin panel
  • Admin panel to ship notifications to all customers
  • Livewire part to render the admin panel

You may be taught extra about this package deal, get full set up directions, and look at the supply code on GitHub.


This package deal was submitted to our Laravel Information Hyperlinks part. Hyperlinks is a spot the neighborhood can put up packages and tutorials across the Laravel ecosystem. Observe alongside on Twitter @LaravelLinks



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments