laravel if auth guard login user code example
Example 1: laravel auth user_id
$userId = Auth::id();
Example 2: how to check if there is an authenticated user laravel
if (Auth::check()) { // The user is logged in... }
$userId = Auth::id();
if (Auth::check()) { // The user is logged in... }