merge([ 'all' => filter_var($this->all, FILTER_VALIDATE_BOOL), ]); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { // append rules to default validation rules return array_merge(parent::rules(), [ 'all' => 'bool', // all or not 'Ids.*' => Rule::exists('files', 'id') // check that file exists in database ->where(fn($query) => $query->where('created_by', Auth::id())) // check file was made by current user ]); } }