public function createBillet($student, $refer) { $due_date = substr($refer, 0, 4) . '-' . substr($refer, -2) . '-'; $recipient = BilletAssignor::first(); $data = ['student_id' => $student->id, 'due_date' => $due_date . $student->day_of_payment, 'amount' => $student->monthly_payment, 'agency' => $recipient->agency, 'digit_agency' => $recipient->digit_agency, 'account' => $recipient->account, 'digit_account' => $recipient->digit_account, 'wallet' => $recipient->wallet, 'agreement' => $recipient->agreement, 'portfolio_change' => $recipient->portfolio_change, 'instruction01' => $recipient->instruction01, 'instruction02' => $recipient->instruction02, 'instruction03' => $recipient->instruction03, 'instruction04' => $recipient->instruction04, 'instruction05' => $recipient->instruction05, 'refer' => $refer, 'note' => 'Fatura gerada automaticamente']; $billet = new Billet(); $billet->fill($data); $billet->save(); return $billet; }