Auth::check()
проверяет, что текущий сеанс имеет аутентифицированного пользователя, либо уже проверенного, либо из сеанса (который будет использовать БД в первый раз) или нулевого значения.
Illuminate \ Auth \ GuardHelpers. php
**
* Determine if the current user is authenticated.
*
* @return bool
*/
public function check()
{
return ! is_null($this->user());
}
Пример @ Подсветка \ Auth \ RequestGuard. php
/**
* Get the currently authenticated user.
*
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
public function user()
{
// If we've already retrieved the user for the current request we can just
// return it back immediately. We do not want to fetch the user data on
// every call to this method because that would be tremendously slow.
if (! is_null($this->user)) {
return $this->user;
}
return $this->user = call_user_func(
$this->callback, $this->request, $this->getProvider()
);
}