Package Data | |
---|---|
Maintainer Username: | michaeljennings |
Maintainer Contact: | michael.jennings91@gmail.com (Michael Jennings) |
Package Create Date: | 2014-12-25 |
Package Last Update: | 2015-03-30 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-15 03:04:07 |
Package Statistics | |
---|---|
Total Downloads: | 12 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A wrapper for the laravel 4 message bag to make it simpler to add and retrieve messages, also flashes messages to the session so they can be retrieved on the next request.
Include the package in your composer.json
.
"michaeljennings/errormanager": "dev-master";
Run composer install
or composer update
to download the dependencies.
Once the package has been downloaded add the validation service provider to the list of service providers in
app/config/app.php
.
'providers' => array(
'Michaeljennings\ErrorManager\ErrorManagerServiceProvider'
);
Add the Error
facade to your aliases array.
'aliases' => array(
'Error' => 'Michaeljennings\ErrorManager\Facades\Error',
);
To add a message into the message bag use the add
method.
Error::add('foo', 'bar');
To check if there are any errors in the current message bag use the hasErrors
method.
Error::hasErrors();
To retrieve the errors from the message bag use the errors
method.
Errors::errors();
You may also use any of the standard message bag functions.
$errors = Errors::errors();
$errors->has('foo)
$errors->first('bar')
You may also redirect with the errors.
return Redirect::back()->withErrors(Errors::errors());