G
G
GaserV2016-04-04 20:40:06
Laravel
GaserV, 2016-04-04 20:40:06

How to check for the presence of a session and redirect to a specific page in its absence?

Tell. I have an admin. /login page. After successful authorization I create a session Session::put('login', $userData['login']);Maybe not correctly somehow. In general, I need that after successful authorization, the user, firstly, was transferred to the main one. And if no session was found when opening any pages of the admin panel, then throw it on the /login.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Muhammad, 2016-04-04
@muhammad_97

Session::has, although Auth::check() or Auth::guest() are more correct

D
Dmitry, 2016-04-05
@Astatroth

Laravel has an intermediary to check if the user is logged in or not. Isn't it easier to use?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question