rafflesargentina / l5-action-based-form-request
Action Based FormRequest for Laravel 5
v1.7.0
2018-12-15 12:23 UTC
Requires
- php: >=7.1.3
- laravel/framework: 5.7.*
Requires (Dev)
- orchestra/testbench: ^3.7
- phpunit/phpunit: ^7.1
- squizlabs/php_codesniffer: 3.*
This package is not auto-updated.
Last update: 2024-11-10 06:01:52 UTC
README
Action Based FormRequest for Laravel 5
Install
Via Composer
$ composer require rafflesargentina/l5-action-based-form-request
Usage
Create a class that extends ActionBasedFormRequest. Then define methods that match the name of each action with request data you want to validate, returning an array with rules.
Example:
<?php namespace App\Http\Requests; use RafflesArgentina\ActionBasedFormRequest\ActionBasedFormRequest; class ArticleRequest extends ActionBasedFormRequest { public static function index() { return [ 'show' => 'numeric|min:1|max:400', 'order' => 'in:asc,desc', ]; } public static function store() { return [ 'title' => 'required|max:100', ]; } public static function update() { return static::store(); } }
And that's it :)
Testing
$ composer test
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.