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