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


PHP User::where方法代碼示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $conversation = Conversation::create(['subject' => $input['subject']]);
     $message = Message::create(['conversation_id' => $conversation->id, 'user_id' => Auth::user()->id, 'body' => $input['message']]);
     $sender = Participant::create(['conversation_id' => $conversation->id, 'user_id' => Auth::user()->id]);
     if ($this->input->has('recipient')) {
         $recipient = User::where('email', $input['recipient'])->first();
         Participant::create(['conversation_id' => $conversation->id, 'user_id' => $recipient->id]);
     }
     return Redirect::route('conversations.index');
 }
開發者ID:shinichi81,項目名稱:laravel-messenger,代碼行數:17,代碼來源:ConversationsController.php

示例2: showProfile

 public function showProfile($user)
 {
     $u = User::where('pseudo', '=', $user)->first();
     if (is_null($u)) {
         App::abort(404);
     }
     if (Auth::user() == $u) {
         $editable = true;
     } else {
         $editable = false;
     }
     $expData = ExperienceManager::getExpInfo($u);
     return view('user.showProfile', ['user' => $u, 'streamer' => $u->isStreamer(), 'editable' => $editable, 'level' => $expData['level'], 'progression' => $expData['progression']]);
 }
開發者ID:quentin-sommer,項目名稱:WebTv,代碼行數:14,代碼來源:UserController.php

示例3: login

 public static function login($username, $password)
 {
     $error = ['user' => FALSE, 'password' => FALSE];
     $logged = FALSE;
     $cookie = ['username' => '', 'email' => ''];
     try {
         $user = User::where('username', $username)->firstOrFail();
     } catch (Exception $e) {
         $error["user"] = TRUE;
         echo "username not found";
         return $error;
     }
     $password = hash('sha256', $password . $user->salt);
     if ($password == $user->password) {
         $logged = TRUE;
         $cookie['username'] = $username;
         $cookie['email'] = $user->email;
         $_SESSION['user'] = $cookie;
     } else {
         $error['password'] = TRUE;
         echo "password doesn't match";
         return $error;
     }
 }
開發者ID:bhshawon,項目名稱:elomelo,代碼行數:24,代碼來源:Authenticate.php

示例4: checkLogin

 public function checkLogin()
 {
     if (empty($_SESSION)) {
         session_start();
     }
     empty($_SESSION['old']) ?: ($_SESSION['old'] = []);
     empty($_SESSION['error']) ?: ($_SESSION['error'] = []);
     $rules = ['email' => FILTER_VALIDATE_EMAIL, 'password' => FILTER_SANITIZE_STRING];
     $sanitize = filter_input_array(INPUT_POST, $rules);
     $error = false;
     if (!$sanitize['email']) {
         $_SESSION['error']['email'] = 'your email is invalid';
         $error = true;
     }
     if (!$sanitize['password']) {
         $_SESSION['error']['password'] = 'you must given your password';
         $error = true;
     }
     if ($error) {
         $_SESSION['flashMessage'] = 'there was a problem';
         $this->redirect(url('login'));
     }
     $user = new User();
     if ($u = $user->where('email', '=', $sanitize['email'])->get()->fetch()) {
         if (password_verify($sanitize['password'], $u->password)) {
             session_regenerate_id(true);
             $_SESSION['secu'] = $sanitize['email'];
             $this->redirect(url('dashboard'));
         }
     }
 }
開發者ID:Antoine07,項目名稱:AppFromScratch,代碼行數:31,代碼來源:FrontController.php

示例5: getUserByEmail

 /**
  * Gets a user by the given E-Mail address
  *
  * @param String $email        	
  * @return Users the user with the given email
  */
 public static function getUserByEmail($email)
 {
     return User::where("email", "=", $email)->first();
 }
開發者ID:ashajjar,項目名稱:mock-aop,代碼行數:10,代碼來源:User.php


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