/**
  * @return bool
  */
 public function process()
 {
     while ($line = fgetcsv($this->csv, 1000, ';')) {
         $transaction = Transaction::firstOrNew(['statement' => $line[2], 'amount' => $this->doConvertion($line[3]), 'balance' => $this->doConvertion($line[4]), 'executed' => Carbon::createFromFormat('d-m-Y', $line[0]), 'rate' => Carbon::createFromFormat('d-m-Y', $line[1])]);
         if (!$this->account->addTransaction($transaction)) {
             return false;
         }
     }
     return true;
 }
Example #2
0
 public function addTransactionToAccount(Account $account)
 {
     $account->addTransaction(new Transaction(array_merge(request()->all(), ['executed' => Carbon::now(), 'rate' => Carbon::now()])));
     return back();
 }