ldc-bogt/app/Http/Requests/Bo/BreederIndexRequest.php
Jérémy Munsch 7cb304e967
Full traça poulets
Cafel APi Eat
Xml flux new
Full Models Rework
Refactorize
2022-06-08 11:44:01 +02:00

42 lines
875 B
PHP

<?php
namespace App\Http\Requests\Bo;
use App\Enums\BreederType;
use Illuminate\Foundation\Http\FormRequest;
class BreederIndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
try {
if (!\is_null($this->type)) {
$this->merge([
'type' => BreederType::make(intval($this->type))
]);
}
} catch (\BadMethodCallException $e) {
$this->merge([
'type' => null
]);
}
return auth()->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'type' => 'nullable'
];
}
}