Exemplo n.º 1
0
 /**
  *
  * @param $user
  */
 private function createTransfer($user)
 {
     $from_account = Account::whereUserId($user->id)->offset(1)->first();
     $to_account = Account::whereUserId($user->id)->first();
     $date = Config::get('budgets.dateBeforeStartingDateForIncomeTransactions');
     $total = 100;
     $description = $this->faker->sentence(1);
     $transaction = new Transaction(['type' => 'transfer', 'date' => $date, 'account_id' => $from_account->id, 'description' => $description, 'merchant' => NULL, 'total' => $total * -1, 'reconciled' => 0, 'allocated' => 0, 'created_at' => $date]);
     $transaction->user()->associate($user);
     $transaction->save();
     $transaction = new Transaction(['type' => 'transfer', 'date' => $date, 'account_id' => $to_account->id, 'description' => $description, 'merchant' => NULL, 'total' => $total, 'reconciled' => 0, 'allocated' => 0, 'created_at' => $date]);
     $transaction->user()->associate($user);
     $transaction->save();
 }