Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code intelephense shows incorrect error: Undefined method 'save'

I'm using the intelephense v1.8.2 extension in VS Code and I'm working on a laravel project. As I get the user using Auth::user(); and call $user->save(); the intelephonse keep showing incorrect error Undefined method 'save'. Is there a way to fix this issue?

enter image description here

like image 658
max256 Avatar asked Apr 28 '26 03:04

max256


1 Answers

You can use @var to ignore this:

/** @var \App\Models\User $user **/
$user = Auth::user();
$user->name = 'alice';
$user->save();
like image 155
cengsemihsahin Avatar answered Apr 29 '26 21:04

cengsemihsahin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!