Laravel
@if (Auth::check())
{{ Auth::user()->id }}
@else
User is not authenticated
@endif