Example #1
0
 /**
  * Show the form for editing the specified deposit.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $deposit = Deposit::find($id);
     return View::make('deposits.edit', compact('deposit'));
 }
 public function doUpdateSendDeposit()
 {
     $username = Input::get('username');
     $amount = Input::get('amount');
     $transaction_id = Input::get('transaction_id');
     $paid = Input::get('paid');
     if (empty($paid)) {
         $paid = 0;
     }
     $deposit_id = Input::get('deposit_id');
     $redirect = Input::get('redirect');
     $user = User::where('username', $username)->first();
     //echo "<pre>Input: "; print_r(Input::all()); echo "</pre>"; exit;
     if (!isset($user->id)) {
         return Redirect::to($redirect)->with('error', Lang::get('admin_messages.user_not_exist'));
     } else {
         $deposit = Deposit::find($deposit_id);
         if (isset($deposit->id)) {
             $deposit->amount = $amount;
             $deposit->transaction_id = $transaction_id;
             $deposit->paid = $paid;
             $deposit->save();
             $message = '';
             if ($paid) {
                 $balance = new Balance();
                 $wallet = new Wallet();
                 $balance->addMoney($amount, $deposit->wallet_id, $user->id);
                 $message = ". " . Lang::get('admin_messages.send_money_user', array('amount' => $amount, 'coin' => $wallet->getType($deposit->wallet_id), 'username' => $user->username));
             }
             return Redirect::to($redirect)->with('success', Lang::get('admin_messages.update_success') . $message);
         } else {
             return Redirect::to($redirect)->with('error', Lang::get('admin_messages.deposit_not_exist'));
         }
     }
 }