/** * Save request inputs into account's incoming transfer * @param \Illuminate\Http\Request $request * @param \App\Account $account Account * @param \App\Operation|null $operation Operation * @return void */ public function saveIncomingTransfer(Request $request, Account $account, $operation) { if (is_null($operation)) { $operation = new Transfer(); } $operation->fill(['from_account_id' => $request->get('from_account_id'), 'to_account_id' => $account->id, 'name' => $request->get('name'), 'amount' => $request->get('amount'), 'date' => Carbon::createFromFormat('d/m/Y', $request->get('date'))->startOfDay()])->save(); }