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


PHP User::whereId方法代碼示例

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


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

示例1: fetchUser

 /**
  * @return User|null
  */
 public function fetchUser()
 {
     $listUser = $this->hasMany('\\App\\Models\\SearchListUser')->join('users', 'search_list_users.user_id', '=', 'users.id')->whereNull('fetched_at')->where('users.status', '=', User::STATUS_AVAILABLE)->orderBy('order')->first(['search_list_users.*']);
     if ($listUser instanceof SearchListUser && $listUser->user_id > 0) {
         $listUser->fetched_at = Carbon::now()->toDateTimeString();
         $listUser->save();
         $user = User::whereId($listUser->user_id)->first();
         $user->status = User::STATUS_PENDENT;
         $user->save();
         return $user;
     } else {
         return null;
     }
 }
開發者ID:Arthas91,項目名稱:twohugs,代碼行數:17,代碼來源:SearchList.php

示例2: alertSoughtUser

 /**
  * Avvisa l'utente che ha accettato l'abbraccio che l'abbraccio è stato creato e che può entrare.
  *
  * @param Hug $hug
  */
 private function alertSoughtUser(Hug $hug)
 {
     $soughtUser = User::whereId($hug->user_sought_id)->first();
     Notifier::send($soughtUser, 'hug', 'created', ['hug_id' => $hug->id, 'search_id' => $hug->search_id, 'created_at' => $hug->created_at]);
 }
開發者ID:Arthas91,項目名稱:twohugs,代碼行數:10,代碼來源:HugController.php

示例3: getDeleteFinish

 public function getDeleteFinish($id)
 {
     $result = array('state' => 0, 'msg' => '');
     try {
         if (!$id) {
             throw new \Exception("Id de Usuario Inválido");
         }
         User::whereId($id)->forceDelete();
         $result['state'] = 1;
     } catch (\Exception $e) {
         $result['msg'] = $e->getMessage();
     }
     return response()->json($result);
 }
開發者ID:josmel,項目名稱:buen,代碼行數:14,代碼來源:AdminController.php

示例4: notifyTheSearcher

 /**
  * Notifica l'utente che ha avviato la ricerca che la ricerca è stata conclusa con successo. Sarà l'app ad occuparsi
  * di inviarmi la conferma a voler entrare nell'abbraccio.
  *
  * @param Search $search
  */
 private function notifyTheSearcher(Search $search)
 {
     $user = User::whereId($search->user_id)->first();
     Notifier::send($user, 'search', 'userFound', ['search_id' => $search->id]);
 }
開發者ID:Arthas91,項目名稱:twohugs,代碼行數:11,代碼來源:SearchController.php

示例5: unlinkUser

 public function unlinkUser($userAccountId, $userId)
 {
     $userAccount = UserAccount::whereId($userAccountId)->first();
     if ($userAccount->hasUserId($userId)) {
         $userAccount->removeUserId($userId);
         $userAccount->save();
     }
     $user = User::whereId($userId)->first();
     if (!$user->public_id && $user->account->company->accounts->count() > 1) {
         $company = Company::create();
         $company->save();
         $user->account->company_id = $company->id;
         $user->account->save();
     }
 }
開發者ID:rafaelsisweb,項目名稱:invoice-ninja,代碼行數:15,代碼來源:AccountRepository.php

示例6: getLastFetchedUser

 /**
  * Ritorna l'ultimo utente estratto
  *
  * @return User|null
  */
 public function getLastFetchedUser()
 {
     $userId = (int) $this->getLastFetchedUserId();
     $user = User::whereId($userId)->first();
     return $user;
 }
開發者ID:Arthas91,項目名稱:twohugs,代碼行數:11,代碼來源:Search.php

示例7: putGroup

 /**
  * Update User Group
  *
  * @param Int $id
  * @param Int $group
  * @param Request $request
  * @return Response
  */
 public function putGroup($id, $group, Request $request)
 {
     if (!$this->appKeyAvailable($request)) {
         return $this->notAuthorized($request);
     }
     if ($this->isSessionEmpty($request)) {
         $this->setResultError("Session token is missing", 401);
     } elseif ($this->setSessionUser($request)) {
         $user = User::whereId($id)->first();
         if (!$this->isAdmin()) {
             $this->setResultError("Unauthorized action", 403);
         } elseif ($user === null) {
             $this->setResultError("User not found", 404);
         } elseif ($group < 1 || $group > 3) {
             $this->setResultError("Group not found", 404);
         } else {
             $user->group_id = $group;
             $user->save();
             $this->setResultOk();
         }
     } else {
         $this->setResultError("Mismatched session token", 401);
     }
     return $this->setResponse();
 }
開發者ID:Baasify,項目名稱:Baasify,代碼行數:33,代碼來源:UsersController.php

示例8: 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)
 {
     User::whereId($id)->update($request->get('user'));
     return redirect()->route('ref.profile');
 }
開發者ID:rodiaa,項目名稱:trpo,代碼行數:12,代碼來源:UserController.php

示例9: function

    return \App\models\Project::whereSlug($slug)->first();
});
$router->bind('clients', function ($id) {
    return \App\models\Client::whereId($id)->first();
});
$router->bind('types', function ($id) {
    return \App\models\Type::whereId($id)->first();
});
$router->bind('phases', function ($id) {
    return \App\models\Phase::whereId($id)->first();
});
Route::get('search/{word}', 'PagesController@search');
Route::resource('clients', 'ClientsController');
Route::resource('types', 'TypesController');
Route::resource('phases', 'PhasesController');
Route::get('phases/addTiming/{id}', 'PhasesController@timing');
Route::get('searchPhase/{word}', 'PhasesController@search');
Route::get('searchClientsPhases/{word}', 'PhasesController@searchcp');
Route::get('searchPerType/{word}', 'PhasesController@searchPerType');
Route::get('phases/updateTaskTitle/{id}', 'PhasesController@updateTaskTitle');
Route::resource('projects', 'PagesController');
Route::get('projects/updateProjectStatus/{arr}', 'PagesController@updateProjectStatus');
Route::get('projects/sortby/{status}', 'PagesController@sortby');
Route::resource('clientsProjects', 'PagesController@searchClientsProjects');
Route::get('projects/singleTask/{id}', 'PagesController@updateSingleTask');
Route::resource('comments', 'CommentController');
Route::get('usersCreate', 'UsersController@create');
$router->bind('users', function ($id) {
    return \App\models\User::whereId($id)->first();
});
Route::resource('users', 'UsersController');
開發者ID:berkapavel,項目名稱:Laravel5-Time-Tracker-Project-manager,代碼行數:31,代碼來源:routes.php


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