/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $cuenta = BankAccount::findOrFail($id);
     $data = $request->all();
     $this->validate($request, BankAccount::$rules);
     $cuenta->update($data);
     return redirect()->route('admin.empresa.show', $request->input('enterprise_id'))->with('message', '<div class="alert alert-success" style="margin-top:15px">Cuenta Bancaria editada con Éxito</div>');
 }
Пример #2
0
 /**
  * 删除银行账户
  * @param integer $id
  * @return redirect
  * @author AndyLee <*****@*****.**>
  */
 public function getDeleteBankAccount($id)
 {
     try {
         $account = BankAccount::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         Session::flash('error', '银行账户信息不存在');
         return redirect()->back();
     }
     if ($account->company_id != Session::get('customer_id')) {
         Session::flash('error', '您没有权限修改此账户');
         return redirect()->back();
     }
     $account->delete();
     Session::flash('success', '删除银行账户完成');
     return redirect()->to(action('BankAccountController@getBankAccount', Session::get('customer_id')));
 }