I already looking for similar issues but didn't help me.
Auth::check
always return false , Auth::guest
always return true, auth middleware work correct(lets request to continue if user is logged in and redirect user to login page if user is not logged in). whats wrong?
EDIT: I understood it occurs in provider boot method , so the question would be : how to check user login status in a provider boot method? this is my provider boot method that share a menu in all views:
public function boot(MenuController $menu_controller)
{
//dd(\Auth::check()) DOES NOT WORK HERE
$nav_menu = $menu_controller::roots()->get();
view()->share('nav_menu',$menus);
}
User
model? – user2094178User
model – alex