Wallogit.com
2017 © Pedro Peláez
This package generates all the needed files and snippets for a CRUD (Create, Read, Update and Delete) API endpoint. This includes: Model, Migration, Controller, Routes and Policy (Used for restricting route access). This package also takes care of validation with the $rules variable in the model., (*2)
php artisan make:crud SomeModelName, (*3)
Run the following command., (*4)
composer require zapsterstudios/crud-generator
Add the following class to the providers array in config/app.php., (*5)
ZapsterStudios\CrudGenerator\PackageServiceProvider::class,
Add the following statement in the render function in app/Exceptions/Handler.php., (*6)
if($exception instanceof \Illuminate\Auth\Access\AuthorizationException) {
if($request->expectsJson()) {
return response()->json(['error' => 'Forbidden.'], 403);
}
}