user()->can('create', Invoice::class); } public function rules() { return [ 'client_id' => 'required', // 'invoice_type_id' => 'integer', // 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx', ]; } protected function prepareForValidation() { $input = $this->all(); $input['client_id'] = $this->decodePrimaryKey($input['client_id']); $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; //$input['line_items'] = json_encode($input['line_items']); $this->replace($input); } }