當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::whereUsername方法代碼示例

本文整理匯總了PHP中App\Model\User::whereUsername方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::whereUsername方法的具體用法?PHP User::whereUsername怎麽用?PHP User::whereUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在App\Model\User的用法示例。


在下文中一共展示了User::whereUsername方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: remindPost

 public function remindPost(Request $request)
 {
     $user = User::whereUsername($request->input('username'))->first();
     if ($user instanceof User) {
         $user->sendPasswordReminder();
     }
     // Doesn't matter if it's not actually a success; don't tell them that.
     $this->alert('success', 'Please check your email.');
     return redirect('/login');
 }
開發者ID:samwilson,項目名稱:asset-manager,代碼行數:10,代碼來源:UsersController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request, Guard $auth)
 {
     $v = \Validator::make($request->all(), ['email' => 'required|email', 'username' => 'required|max:255', 'password' => 'required|confirmed']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     }
     $user = new User();
     if (User::whereEmail($request->input('email'))->count() < 1 && User::whereUsername($request->input('username'))->count() < 1) {
         $user->username = $request->input('username');
         $user->email = $request->input('email');
         $user->password = \Hash::make($request->input('password'));
         if ($user->save()) {
             \Auth::login($user);
             return redirect()->route('tasks.index');
         }
     }
     return redirect()->back()->with("NOTIF_INFO", "Email or Username have been registered");
 }
開發者ID:abidnurulhakim,項目名稱:qa-crawler,代碼行數:23,代碼來源:SiteController.php

示例3: save

 public function save(Request $request, $id = null)
 {
     if (!$this->user->isAdmin()) {
         return redirect('crews');
     }
     \DB::beginTransaction();
     $crew = Crew::findOrNew($id);
     $crew->name = $request->input('name');
     $crew->comments = $request->input('comments');
     $crew->save();
     // Save crew members.
     \DB::table('crew_members')->where('crew_id', '=', $crew->id)->delete();
     foreach (explode(',', $request->input('members')) as $member) {
         $user = User::whereUsername($member)->first();
         if ($user) {
             $crewMember = new CrewMember();
             $crewMember->user_id = $user->id;
             $crewMember->crew_id = $crew->id;
             $crewMember->save();
         }
     }
     // Save availability dates.
     \DB::table('crew_unavailabilities')->where('crew_id', '=', $crew->id)->delete();
     foreach ($request->input('unavailabilities') as $unavail) {
         if (empty($unavail['start_date']) && empty($unavail['end_date'])) {
             continue;
         }
         $date = new \App\Model\CrewUnavailability();
         $date->crew_id = $crew->id;
         $date->start_date = $unavail['start_date'];
         $date->end_date = $unavail['end_date'];
         $date->save();
     }
     \DB::commit();
     return redirect('crews');
 }
開發者ID:samwilson,項目名稱:asset-manager,代碼行數:36,代碼來源:CrewsController.php


注:本文中的App\Model\User::whereUsername方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。