if(Auth::check()) { // user is logged in } else { // user is not logged in }
if(!Auth::check()) { redirect('login.php'); }In this example, the `Auth::check()` function is used in combination with a conditional statement to redirect the user to the login page if they are not logged in. The `!` operator is used to negate the boolean value returned by the `Auth::check()` function. Package Library: Auth LoggedIn function is provided by Laravel authentication library.