/** * Get a list of estimations * * @return static */ public function getList() { $estimations = $this->estimation->with(['category', 'currency'])->get(); $response = $estimations->map(function ($estimation) { return ["id" => $estimation->id, "amount" => $this->money->fromStoredMoney($estimation->amount), "start_date" => $estimation->start_date, "end_date" => $estimation->end_date, "day" => $estimation->day, "currency" => $estimation->currency->name, "category" => $estimation->category->name]; }); return $response; }
/** * Get a list of currencies * * @return static */ public function getList() { $currencies = $this->currency->all(); $response = $currencies->map(function ($item) { return ["id" => $item->id, "name" => $item->name, "exchange_rate" => $this->money->fromStoredMoney($item->exchange_rate)]; }); return $response; }
/** * Get a list of credit cards * * @return static */ public function getList() { $creditCards = $this->creditCard->all(); $response = $creditCards->map(function ($item) { return ["id" => $item->id, "name" => $item->name, "fee" => $this->money->fromStoredMoney($item->fee), "insurance" => $this->money->fromStoredMoney($item->insurance)]; }); return $response; }