ldc-legaulois/app/Http/Requests/RecipeIndexRequest.php
2021-03-21 22:51:19 +01:00

38 lines
939 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class RecipeIndexRequest 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 [
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
'type' => [function ($attribute, $value, $fail) {
if (!in_array($value, ['range', 'consumption', ' preparation', 'cooking'])) {
$fail('Unkown type search');
}
}],
'value' => 'sometimes',
'search' => 'sometimes',
'video_recipe' => 'sometimes'
];
}
}