phplaravelvisual-studio-codeintelephense

Undefined type 'Validator'.intelephense(1009)


Can anyone help me with this error? Im new to laravel and i was making a productController file but im getting this error from Validator:

enter image description here

I have called use Validator; What else can i do


Solution

  • Install the following package:

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

    After, run:

    php artisan ide-helper:models
    php artisan ide-helper:generate
    php artisan ide-helper:meta
    

    And finally, install this extension on your vs code: https://marketplace.visualstudio.com/items?itemName=georgykurian.laravel-ide-helper

    Also, another good to have (optional): https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client

    It should solve your problem.