Download the PHP package rickselby/laravel-edvinaskrucas-notification without Composer
On this page you can find all versions of the php package rickselby/laravel-edvinaskrucas-notification. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-edvinaskrucas-notification
Notification package for Laravel
A simple notification management package for Laravel.
- Notification containers
- Notification collections
- Notification messages
- Formats for notifications
- Flash / instant notifications
- Method chaining
- Message positioning
Installation
Just place require new package for your laravel installation via composer.json
"rickselby/laravel-edvinaskrucas-notification": "6.*"
Then hit
Version matrix
Laravel Version | Package version |
---|---|
6.x - 11.x | 6.* |
= 5.4 | 5.2.* |
>= 5.1 | 5.1.* |
>= 5.0, < 5.1 | 5.0.* |
>= 4, < 5 | >= 2, <= 3 |
Registering to use it with laravel
Add following lines to
ServiceProvider array
Kernel middleware array ()
Now you are able to use it with Laravel4.
Publishing config file
If you want to edit default config file, just publish it to your app folder.
php artisan vendor:publish --provider="\Krucas\Notification\NotificationServiceProvider" --tag="config"
Usage
Default usage
Adding message to default container.
Containers
Containers allows you to set up different containers for different placeholders.
You can pass closure to modify containers, simply use this syntax showed below
Also you can access container like this
Method chaining
If you want to use default container just use as container name. Name will be taken from config file.
Instant notifications (shown in same request)
Library supports not only flash messages, if you want to show notifications in same request just use
Custom single message format
Want a custom format for single message? No problem
Also you can still pass second param (format), to format messages, but you can format individual messages as shown above.
Add message as object
You can add messages as objects
When adding message as object you can add additional params to message
Add message as closure
You can add messages by using a closure
Accessing first notification from container
You can access and show just first notification in container
Accessing first notification from all types
Displaying notifications
To display all notifications in a default container you need to add just one line to your view file
When using you may want to group your messages by type, it can be done like this
This will group all your messages in group and output it, also you can use just one, two or three groups.
Manipulating group output on the fly
Display notifications by type in default container, you can pass custom format
Displaying notifications in a specific container with custom format.
Or you can just use blade extension
Message positioning
There is ability to add message to certain position.
Clearing messages
You can clear all messages or by type.
Add message and display it instantly in a view file
Want to add message in a view file and display it? Its very simple:
You can also add multiple messages