83 lines
1.4 KiB
PHP
83 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class BaseFormRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return match($this->method()){
|
|
'POST' => $this->store(),
|
|
'PUT', 'PATCH' => $this->update(),
|
|
'DELETE' => $this->destroy(),
|
|
default => $this->index()
|
|
};
|
|
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the get request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function index()
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the post request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function store()
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the put/patch request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function update()
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the delete request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function destroy()
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
}
|