You can fix that by using DocBlock with @var to define varialbe type then use that varialbe as User model instance
/** * @var \App\Models\User $user; */ $user = auth()->user(); dd($user->id);