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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -