Package Data | |
---|---|
Maintainer Username: | diegoalvarezb |
Package Create Date: | 2017-08-30 |
Package Last Update: | 2017-09-03 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-23 03:04:12 |
Package Statistics | |
---|---|
Total Downloads: | 10 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This tool handle front messages in Laravel.
As Laravel allows by default to add flash (session) messages that will be shown in the next page, this package allows to join those messages with the ones you want to add in the current view.
So using this package you could manage messages regardless of whether you are rendering a view or redirecting to another route.
Package installation with composer:
composer require diegoalvarezb/laravel-front-messages
And add the service provider in your config/app.php
file:
Diegoalvarezb\FrontMessages\FrontMessagesServiceProvider::class
To add a message in a controller you have to add the Diegoalvarezb\FrontMessages\FrontMessagesTrait
. With this trait you could use the addHtmlMessage
method:
$this->addHtmlMessage($type, $message);
You can add as many messages as you like in every moment.
You have to execute this command:
php artisan vendor:publish --tag=front-messages
This command will copy the default view into the resources/views/vendor folder. After that, you could edit this file, and use it in any blade template:
@include('vendor.front-messages.messages')
There are four types of messages:
$this->addHtmlMessage('danger', 'This is an example of danger message');
$this->addHtmlMessage('info', 'This is an example of info message');
$this->addHtmlMessage('success', 'This is an example of success message');
$this->addHtmlMessage('warning', 'This is an example of warning message');
MIT