user()->can('create', Payment::class); } public function rules() { $this->sanitize(); return [ 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx', 'client_id' => 'integer|nullable', 'payment_type_id' => 'integer|nullable', 'amount' => 'numeric', 'payment_date' => 'required', ]; } public function sanitize() { $input = $this->all(); if(isset($input['invoices'])) $input['invoices'] = $this->transformKeys(array_column($input['invoices']), 'id'); $this->replace($input); return $this->all(); } public function messages() { } }