/** * Update the specified resource in storage. * PUT /currencies/{id} * * @param int $id * @return Response */ public function update($id, Request $request) { $currency = Currency::findOrFail($id); $this->validate($request, Currency::$rules); $currency->update($request->all()); return redirect('currencies')->with('success', l('This record has been successfully updated :: (:id) ', ['id' => $id], 'layouts') . $request->get('name')); }
/** * 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]; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $currency = Currency::findOrFail($id); $currency->delete(); Session::flash('message', 'El registro fue eliminado'); return redirect()->route('settings.currency.index'); }
public function checkPayerAccount($payer, $request) { // check validity of payer account // check transaction log for the day // check sufficient kudos // debit from paypal if required // send notification to payer and payee if ($payer->account_status->status = 'active') { // Calculate number of kudos $noOfKudos = Currency::findOrFail($request->txn_currencyid)->Kudos_exchange * $request->amount_in_txn_currency; // Check transaction_limit if ($payer->transaction_limit_kudos >= $noOfKudos) { session()->flash('flash_message', 'Within transaction limit.'); // Check daily_limit if ($payer->kudos_used_today + $noOfKudos <= $payer->daily_limit_kudos) { session()->flash('flash_message', 'Within daily limit'); // Check if need to go to payment gateway if ($payer->kudos_available_balance < $noOfKudos) { if ($this->PaypalApproved()) { session()->flash('flash_message', 'Approved by Payment Gateway'); return 0; } else { session()->flash('flash_message', 'Unapproved by Payment Gateway, try another card'); return 85; } } else { session()->flash('flash_message', 'Transaction approved using existing kudos.'); return 0; } } else { session()->flash('flash_message', 'Exceeded daily limit'); return 51; } } else { session()->flash('flash_message', 'Exceeded transaction limit.'); return 51; } } else { session()->flash('flash_message', 'Payer account not active'); } session()->flash('flash_message', 'Payer account not approved - unknown error'); return 14; }