in laravel $user = Auth::user(); user() is a function written over where code example
Example 1: laravel auth namespace
use Illuminate\Support\Facades\Auth;
Example 2: laravel force login by id
Auth::login($user);
use Illuminate\Support\Facades\Auth;
Auth::login($user);