Auth::user() get id laravel 6x

PHP
// Get the currently authenticated user's ID...
$id = Auth::id();$userId = Auth::id();
Source

Also in PHP: