【发布时间】:2019-11-16 06:53:16
【问题描述】:
我在 Laravel 5.8 上有一个应用程序。每次用户在应用程序上停留很长时间时,都会出现此错误
试图获取非对象的属性“名称”(查看:C:\xampp\htdocs\jairusreport\resources\views\layouts\header.blade.php)
几天来,我一直在与一个特定的错误作斗争,这真的浪费了我的时间。我已经完成了下面错误的截图。
身份验证/登录控制器
class LoginController extends Controller
{
use AuthenticatesUsers;
protected $redirectTo = '/dashboard';
protected function hasTooManyLoginAttempts ($request) {
$maxLoginAttempts = 2;
$lockoutTime = 5; // 5 minutes
return $this->limiter()->tooManyAttempts(
$this->throttleKey($request), $maxLoginAttempts, $lockoutTime
);
}
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function logout()
{
$user = Auth::user();
Log::info('User Logged Out. ', [$user]);
Auth::logout();
Session::flush();
return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/login');
}
}
问题的原因是什么。我该怎么做才能解决这个问题。
【问题讨论】:
标签: laravel