Authenticating users is as simple as adding an authentication middleware to your Laravel route definition:
Route::get('/profile', ProfileController::class)
->middleware('auth');
Once the user is authenticated, you can access the authenticated user via the Auth
facade:
use Illuminate\Support\Facades\Auth;
// Get the currently authenticated user...
$user = Auth::user();
Of course, you may define your own authentication middleware, allowing you to customize the authentication process.
For more information on Laravel's authentication features, check out the authentication documentation.