Megaphone is a Livewire UI for Laravel-based user notifications. It uses built-in Laravel notification features to allow you to add bell icons to your Livewire app:
use MBarlow\Megaphone\Types\Important;use App\Models\User;$notification = new Important(// Notification Title'Expected Downtime!',// Notification Body'We are expecting some downtime today at around 15:00 UTC for some planned maintenance. Read more on a blog post!','https://example.com/link', // Optional'Read More...' // Optional);$user->notify($notification);
Using the above code, you can render notifications in your app using the provided Blade component:
This package has other neat features to manage notifications and send them en masse to users:
- Custom notification types
- Command to clear announcements
- Customizable list of notification types in the admin panel
- Admin panel to send notifications to all users
- Livewire component to render the admin panel
You can learn more about this package, get full installation instructions, and view the source code on GitHub.
This package was submitted to our Laravel News Links section. Links is a place the community can post packages and tutorials around the Laravel ecosystem. Follow along on Twitter @LaravelLinks
Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.