php - Auth::guest() returns true for both logged in and logged out users -


i new laravel , trying create small project learning purpose. have used inbuilt auth login , register. these automatically generated pages work well, in created route resource posts using controller called postcontroller.

now in postcontroller check if user authorized return view: posts else login page. check following

if (!auth::guest())  return view('posts');  else  return "......"; 

now here auth::guest() returns true both logged in , logged out users.

are sure logged in?

try dump auth::user() data with

dd(auth::user());

and way, if returning in if statement not need use else.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -