user(); return $user->isAdmin(); } public function rules() { $rules = []; if ($this->file('documents') && is_array($this->file('documents'))) { $rules['documents.*'] = 'required|file|max:1000000|mimes:xml'; } elseif ($this->file('documents')) { $rules['documents'] = 'required|file|max:1000000|mimes:xml'; } return $rules; } public function prepareForValidation() { $input = $this->all(); $this->replace($input); } }