user()->can('edit', $this->purchase_order); } public function rules() { $rules = []; if($this->file('documents') && is_array($this->file('documents'))) $rules['documents.*'] = $this->file_validation; elseif($this->file('documents')) $rules['documents'] = $this->file_validation; if ($this->file('file') && is_array($this->file('file'))) { $rules['file.*'] = $this->file_validation; } elseif ($this->file('file')) { $rules['file'] = $this->file_validation; } return $rules; } }