Home > Enterprise >  Visual studio code keep showing unecesarry error
Visual studio code keep showing unecesarry error

Time:11-01

I dont know why the error message keep showing in my problem tab

This screenshot my vscode enter image description here

that message show after adding method destroy

CodePudding user response:

Intelephense extension is checking for Undefined Methods, if you don't want that warning Add this line in your vs code settings.json file.

"intelephense.diagnostics.undefinedMethods": false

CodePudding user response:

If the code is working fine, then it's just your ide complaining.

Please try the following package:

composer require --dev barryvdh/laravel-ide-helper

then run:

php artisan ide-helper:generate

This package will then install the necessary files for your ide.

Note: You will need to run generate command whenever you have new package installed to avoid error from your ide.

more on ide helper

CodePudding user response:

The Auth::user() return type is not the User model instance. And that's why it's shown as error. You can use comment to define the variable as an instance of the User model like,

/** @var User $ketua */
$ketua = Auth::user();
  • Related