Download the PHP package pyaesone17/laravel-pretty-handler without Composer
On this page you can find all versions of the php package pyaesone17/laravel-pretty-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pyaesone17/laravel-pretty-handler
More information about pyaesone17/laravel-pretty-handler
Files in pyaesone17/laravel-pretty-handler
Package laravel-pretty-handler
Short Description :package_description
License MIT
Homepage https://github.com/pyaesone17/laravel-pretty-handler
Informations about the package laravel-pretty-handler
Laravel Pretty Handler
The package will allow you to define the error view based on model and based on the request.
Frontend view of Shop Model Not Found Exception
Backend view of Shop Model Not Found Exception
Install
Via Composer
Usage
Firstly register the serviceprovider in config/app.php like this
Resolve \Pyaesone17\LaravelPrettyHandler\PrettyHandler like this in the render method of App\Exceptions\Handler.
In the model you have to implement \Pyaesone17\LaravelPrettyHandler\Pretty trait and set up using setUp method.
prettyDefaultView will be default view of the App\User not found exception.
prettyRules will accept the array list with url and view.
In the following example, if the exception occurs in admin section errors.backend page will show.
If request does not match any url value, it will show default page of the Model that is defined in prettyDefaultView.
Note
Do not use \Pyaesone17\LaravelPrettyHandler\PrettyHandler::class directly in Handler because it recieve constructor value from the Service Container.
You have to resolve the class fromn the container.
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONDUCT for details.