rafflesargentina / l8-restful-controller
RESTful Controller for Laravel 8
v1.1
2021-05-14 14:14 UTC
Requires
- php: >=7.3
- laravel/framework: 8.*
Requires (Dev)
- orchestra/testbench: ^6.9
- phpunit/phpunit: ^9.5
- rafflesargentina/l8-repository: ^1.0
- squizlabs/php_codesniffer: ^3.5
This package is not auto-updated.
Last update: 2024-12-07 07:33:37 UTC
README
RESTful Controller for Laravel 8
Install
Via Composer
$ composer require rafflesargentina/l5-resource-controller
Usage
Create a controller like you normally would and change it to extend ResourceController class. Then set $repository an $resourceName properties:
- $repository: The Repository class to instantiate.
- $resourceName: Set routes resource name.
Also you can set these optional properties:
- $alias: The alias for named routes.
- $theme: The location for themed views.
- $module: Set views vendor location prefix.
- $prefix : The vendor views prefix.
- $formRequest: The FormRequest class to instantiate (also take a look at l5-action-based-form-request).
- $useSoftDeletes: Define if model uses SoftDeletes.
- $infoFlashMessageKey: The info flash message key.
- $errorFlashMessageKey: The info flash message key.
- $successFlashMessageKey: The info flash message key.
- $warningFlashMessageKey: The info flash message key.
Example:
<?php namespace App\Http\Controllers; use RafflesArgentina\ResourceController\ResourceController; use App\Http\Requests\ArticleRequest; use App\Repositories\ArticleRepository; class ArticlesController extends ResourceController { protected $repository = ArticleRepository::class; protected $formRequest = ArticleRequest::class; protected $resourceName = 'articles'; }
And that's it :)
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email mario@raffles.com.ar instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.