zapsterstudios / crud-generator
1.0.0
2017-06-02 00:27 UTC
This package is not auto-updated.
Last update: 2025-06-08 06:39:32 UTC
README
Laravel-API-CRUD-Generator
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.
Usage
php artisan make:crud SomeModelName
Installation
Install with Composer
Run the following command.
composer require zapsterstudios/crud-generator
Register ServiceProvider
Add the following class to the providers
array in config/app.php
.
ZapsterStudios\CrudGenerator\PackageServiceProvider::class,
Handle Policy AuthorizationException
Add the following statement in the render
function in app/Exceptions/Handler.php
.
if($exception instanceof \Illuminate\Auth\Access\AuthorizationException) { if($request->expectsJson()) { return response()->json(['error' => 'Forbidden.'], 403); } }