Example #1
0
 /**
  * Updates a expense
  *
  * @param $input
  * @param $id
  *
  * @return array
  */
 public function update($input, $id)
 {
     $expense = $this->expense->findOrFail($id);
     $expense->description = $input->description;
     $expense->date = $input->date;
     $expense->amount = $this->money->toStoredMoney($input->amount);
     $expense->category_id = $input->category_id;
     $expense->currency_id = $input->currency_id;
     $destination = $this->getDestination($input->destination_type, $input->destination_id, $expense->date);
     $destination->expenses()->save($expense);
     return ["id" => $expense->id];
 }
 /**
  * Updates a estimation
  *
  * @param $input
  * @param $id
  *
  * @return array
  */
 public function update($input, $id)
 {
     $estimation = $this->estimation->findOrFail($id);
     $estimation->update(['amount' => $this->money->toStoredMoney($input->amount), 'start_date' => $input->start_date, 'end_date' => $input->end_date, 'day' => $input->day, 'category_id' => $input->category_id, 'currency_id' => $input->currency_id]);
     return ["id" => $estimation->id];
 }
 /**
  * Updates a currency
  *
  * @param $input
  * @param $id
  *
  * @return array
  */
 public function update($input, $id)
 {
     $currency = $this->currency->findOrFail($id);
     $currency->update(['name' => $input->name, 'exchange_rate' => $this->money->toStoredMoney($input->exchange_rate)]);
     return ["id" => $currency->id];
 }
 /**
  * Updates a credit card
  *
  * @param $input
  * @param $id
  *
  * @return array
  */
 public function update($input, $id)
 {
     $creditCard = $this->creditCard->findOrFail($id);
     $creditCard->update(['name' => $input->name, 'fee' => $this->money->toStoredMoney($input->fee), 'insurance' => $this->money->toStoredMoney($input->insurance)]);
     return ["id" => $creditCard->id];
 }