public static function add(User $user, Bank $bank, $address, $name, $account) { if (UserBank::where('user_id', $user->id)->exists()) { $is_lock = 0; } else { $is_lock = 1; } return UserBank::saveData(['bank_id' => $bank->id, 'user_id' => $user->id, 'address' => $address, 'name' => $name, 'bank_name' => $bank->name, 'account' => $account, 'status' => 1, 'is_lock' => $is_lock]); }
/** * 银行信息 * * @date 2015-10-13 * @return [type] [description] */ public function banks() { $data['userBanks'] = UserBank::join('users', 'users.id', '=', 'user_banks.user_id')->join('banks', 'user_banks.bank_id', '=', 'banks.id')->select('users.id', 'users.username', 'banks.name', 'user_banks.account', 'user_banks.address', 'user_banks.name as uname')->paginate(10); // dd($data); return view('backend.users.banks', $data); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy() { $id = Request::input('num'); $r = UserBank::where('id', $id)->delete(); return success('删除成功'); }