Download the PHP package gaaarfild/laravel-notifications without Composer
On this page you can find all versions of the php package gaaarfild/laravel-notifications. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gaaarfild/laravel-notifications
More information about gaaarfild/laravel-notifications
Files in gaaarfild/laravel-notifications
Package laravel-notifications
Short Description Convenient flash notifications
License MIT
Informations about the package laravel-notifications
Laravel Convenient System Notifications
Russian Documentation / Русская документация
Notification system for Laravel 5.
Often after saving some data from user you have to redirect to proper page and notificate user that everything done successfully or some errors appeared.
Now you can do this more convenient and easy way.
Install
To install, execute the following command in the console:
When completed, add to your config/app.php
file in the providers
section
If you want to use Notifications
facade, add to same file at the aliases
section
To change the templates, please execute the following command in the console:
php artisan vendor:publish --provider="Garf\LaravelNotifications\LaravelNotificationsServiceProvider" --tag="config"
Now you will be able to set any view file for notifications render in config/laravel-notifications.php
.
Optionally you can execute the following command in the console to edit the default template, instead of using your own:
php artisan vendor:publish --provider="Garf\LaravelNotifications\LaravelNotificationsServiceProvider" --tag="views"
Note: If you publish the view and edit it, do not change the name of the view in the config file.
Usage
Save messages for the next request
$type
param used especially for Twitter Bootstrap render. It displays alerts with respective class.
i.e. If you set type
to danger
, alert with class 'alert alert-danger' will be generated on toBootstrap()
format method.
$group
param groups messages to groups. :) On the next Request you can retrieve them by group.
Also more convenient aliases can be used:
Retrieving messages
All messages
Messages by group
Messages by type
Format messages
You also can format messages
JSON
You can retrieve and format all messages as JSON
Or can filter them by group or type
Render with blade view files
You can also render your notifications with custom view files
And you can filter them by group or type as well:
by default method uses Twitter Bootstrap alerts format.
Twitter Bootstrap can be required.
Other
Count Messages
Check if messages exist
Get First Message
Form Request usage
If you want to display errors via Laravel Form Request, you have to override method formatErrors()
in your Form Request Class.
Don't forget to import Validator
class in head of the file:
use Illuminate\Contracts\Validation\Validator;
Contributions
Contributions are highly appreciated.
Send your pull requests to master
branch.
License
The MIT License (MIT). Please see License File for more information.