user()->can('edit', $this->vendor); } public function rules() { $rules = []; if ($this->file('documents') && is_array($this->file('documents'))) { $rules['documents.*'] = $this->fileValidation(); } elseif ($this->file('documents')) { $rules['documents'] = $this->fileValidation(); } if ($this->file('file') && is_array($this->file('file'))) { $rules['file.*'] = $this->fileValidation(); } elseif ($this->file('file')) { $rules['file'] = $this->fileValidation(); } $rules['is_public'] = 'sometimes|boolean'; return $rules; } public function prepareForValidation() { $input = $this->all(); if(isset($input['is_public'])) { $input['is_public'] = $this->toBoolean($input['is_public']); } $this->replace($input); } }