当前位置: 首页>>代码示例>>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;未经允许,请勿转载。