Laravel Middleware非对象的数据库值

I recently started working with php Laravel so I might be off base here, but I figured it won't hurt to ask.

I am trying to determine the preferred language of each user. Doing so on the blades gets the job done, but I read that it should be set outside the blade pages.

I made a new Middleware and I can set it up there, but I am not sure why it doesn't catch the actual database value.

public function handle($request, Closure $next)
{   
        if (Auth::User())
            App::setLocale(Auth::User()->lang);
        else
            App::setLocale('en');

    return $next($request);
}   

This part App::setLocale('en'); works fine and it sets up the locale to all pages. The condition above it Auth::User() is never true though so locale is never being set up based on the lang value. When I try to run it anyway, it gives an ErrorException - Trying to get property of non-object error.

Any help would be appreciated.

BUDDY! try $locale = App::getLocale(); instead of Auth::User()->lang you owe me a FIFA Game!