user()->can('edit', $this->purchase_order); } public function rules() { $rules = []; if ($this->input('documents')) { $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000'; } return $rules; } }