38 lines
939 B
PHP
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'
|
|
];
|
|
}
|
|
}
|