当前位置: 首页>>代码示例>>PHP>>正文


PHP User::findOrfail方法代码示例

本文整理汇总了PHP中app\User::findOrfail方法的典型用法代码示例。如果您正苦于以下问题:PHP User::findOrfail方法的具体用法?PHP User::findOrfail怎么用?PHP User::findOrfail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\User的用法示例。


在下文中一共展示了User::findOrfail方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 public function show($id)
 {
     $user = User::findOrfail($id);
     $histories = $user->histories;
     $customer = $user->customer;
     if (Gate::denies('show', $customer)) {
         abort('403', 'Sorry, not sorry');
     }
     return view('customer.show', compact('histories', 'customer'));
 }
开发者ID:Antoine07,项目名称:appStarwars,代码行数:10,代码来源:CustomerController.php

示例2: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $validator = Validator::make($request->all(), ['email' => 'required|email', 'contact' => 'required|integer|max:9999999999']);
     if ($validator->fails()) {
         return redirect('/profile')->withErrors($validator)->withInput();
     } else {
         $user = User::findOrfail(Auth::user()->id);
         $users = $user->update(['name' => ucwords($request->name), 'email' => $request->email, 'contact' => $request->contact, 'address' => $request->address]);
         return Redirect::to('/home');
     }
 }
开发者ID:Khande1n,项目名称:aftercares,代码行数:18,代码来源:UserProfileController.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Requests\EditUserRequest $request, $id)
 {
     $user = User::findOrfail($id);
     $user->fill($request->all());
     if ($request->password != null) {
         $user->password = bcrypt($request->password);
     }
     dd($user->password);
     $user->save();
     session::flash('message', 'Usuario editado de los registros');
     return redirect()->route('admin.users.index');
 }
开发者ID:naziio,项目名称:Crossfitpocurotitulo2,代码行数:19,代码来源:AdminController.php

示例4: admin

 public function admin($id)
 {
     $user = User::findOrfail($id);
     if ($user->admin == 1) {
         $admin = 0;
     }
     if ($user->admin == 0) {
         $admin = 1;
     }
     $user->admin = $admin;
     $user->save();
     Flash::success('সঠিক ভাবে সম্পন্ন হয়েছে।');
     return redirect()->back();
 }
开发者ID:polashmahmud,项目名称:awesomebua,代码行数:14,代码来源:AdminController.php

示例5: delete

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function delete($id)
 {
     // dd($id);
     $dataUser = User::findOrfail($id);
     $dataUse = User::where('id', $id)->get();
     foreach ($dataUse as $d) {
         $admin_id = $d->user_id;
     }
     $data = AdminModel::findOrfail($admin_id);
     $dataUser->delete($id);
     $data->delete($admin_id);
     return back()->with('message', 'admin data delete successfully.....');
 }
开发者ID:hasanmahamud31,项目名称:test-repo,代码行数:19,代码来源:AdminController.php

示例6: delete

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function delete($id)
 {
     // dd($id);
     $dataUser = User::findOrfail($id);
     $dataUse = User::where('id', $id)->get();
     foreach ($dataUse as $d) {
         $user_id = $d->user_id;
     }
     $data = UserModel::findOrfail($user_id);
     $dataUser->delete($id);
     $data->delete($user_id);
     return redirect()->route('user_manage')->with('message', 'user data delete successfully.....');
 }
开发者ID:hasanmahamud31,项目名称:test-repo,代码行数:19,代码来源:UserController.php

示例7: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $user = User::findOrfail($id);
     return view('User.show', compact('user'));
 }
开发者ID:shubhang-arora,项目名称:LMS-Discussion-Forum,代码行数:11,代码来源:UsersController.php

示例8: password

 public function password(Request $request)
 {
     $this->validate($request, ['password' => 'required|confirmed|min:6']);
     $id = Auth::user()->id;
     $password = User::findOrfail($id);
     $password->password = bcrypt($request->password);
     $password->save();
     Flash::success('আপনি সঠিক ভাবে সম্পাদন করেছেন!');
     return redirect()->back();
 }
开发者ID:polashmahmud,项目名称:awesomebua,代码行数:10,代码来源:AuthController.php

示例9: postChangePassword

 public function postChangePassword(Request $request)
 {
     $data = $request->except('_token');
     if (!ServiceAccount::checkCaptcha($data)) {
         return redirect()->route('user.get.changePassword');
     } else {
         if ($data['new_password'] != $data['rePass'] || strlen($data['new_password']) < 6 || strlen($data['new_password']) > 15) {
             return redirect()->route('user.get.changePassword')->with('message', 'Password mới phải trùng nhau và ký tự >6 và <15.');
         }
         if (\Hash::check($data['password'], Auth::user()->password)) {
             $user = User::findOrfail(Auth::user()->id);
             //dd($data);
             $user->password = \Hash::make($data['new_password']);
             $user->save();
             $model = new GAccount();
             //check all user if exsit on all server game
             $servers = Server::all();
             foreach ($servers as $server) {
                 $model->setConnection($server->user_db);
                 try {
                     $account = $model->where('loginName', $user->username)->first();
                 } catch (\Exception $e) {
                     return redirect()->route('user.register')->with('error', 'có lỗi!');
                 }
                 $account->password_hash = ServiceAccount::getPassword($data['new_password']);
                 $account->save();
             }
             return redirect()->route('user.profile')->with('message', 'Đổi mật khẩu thành công!');
         }
     }
 }
开发者ID:louisthaihv,项目名称:colong,代码行数:31,代码来源:AuthController.php


注:本文中的app\User::findOrfail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。