type) { $this->merge([ 'type' => $this->type ]); } if ($this->value) { $this->merge([ 'value' => $this->value ]); } if ($this->search) { $this->merge([ 'search' => $this->search ]); } if ($this->video_recipe) { $this->merge([ 'video_recipe' => $this->video_recipe ]); } return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'type' => [ 'sometimes', // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed,Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed function ($attribute, $value, $fail) { if (!in_array($value, RecipeFilter::toValues())) { throw new RedirectTo(route('recipes.index')); } } ], 'value' => 'sometimes', 'search' => 'sometimes', 'video_recipe' => 'sometimes' ]; } }