本文整理汇总了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;
}
}
示例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]);
}
示例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);
}
示例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]);
}
示例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();
}
}
示例6: getLastFetchedUser
/**
* Ritorna l'ultimo utente estratto
*
* @return User|null
*/
public function getLastFetchedUser()
{
$userId = (int) $this->getLastFetchedUserId();
$user = User::whereId($userId)->first();
return $user;
}
示例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();
}
示例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');
}
示例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');