Package to help organize form request validation for Laravel
finalgamer/laravel-method-form-request is a Laravel package for package to help organize form request validation for laravel.
It currently has 0 GitHub stars and 3.898 downloads on Packagist (latest version v1.3).
Install it with composer require finalgamer/laravel-method-form-request.
Discover more Laravel packages by finalgamer
or browse all Laravel packages to compare alternatives.
Last updated
This package helps you organize request validation data for Laravel form requests.
Instead of having multiple form request files for creating and updateing you can store both validation rules in the same file.
Install as a composer dependency.
composer require finalgamer/laravel-method-form-request
<?php
namespace App\Http\Requests;
use LaravelMethodFormRequest\FormRequest;
class UserRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function createRules(): array
{
return [
'name' => 'required|string',
'email' => 'required|email',
'password' => 'required|string',
];
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function updateRules(): array
{
return [
'name' => 'string',
'email' => 'email',
'password' => 'string',
];
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function deleteRules(): array
{
// Also supports DELETE requests. Altough this is used very rarely.
return [];
}
}