How can I get around this warning in PhpStorm?
Property 'id' not found in IlluminateContractsAuthAuthenticatable|null
for
auth()->user()->id
Note, that this question relates to PhpStorm not Laravel. The id exists and Laravel doesn’t show the warning. The IDE does.
2
Answers
Maybe you can try with
Auth::user()->id
and you can show this warning, you should to do add(auth()->user())
and you can show that are happening. Maybe your user it´s not logged and for this Laravel show this warningPhpstorm does not know about the object. You can add something like this to your user model: