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

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -