I'm using PHP Storm v8.0.3 with the latest version of Laravel.
I'm having trouble making the autocomplete work.
As you can see in the image above.
I have installed barryvdh ide-helper, following the readme he provides on git. I haven't received any errors during its installation.
I have included it in the providers
array as either
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider'
or
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider:class
It didn't make any difference(as far as I can tell).
I have also installed the Laravel plugin.
Again, no difference, still no auto-complete.
I tried dumping the config file which resulted in:
array:27 [▼
...
22 => "Illuminate\View\ViewServiceProvider"
23 => "Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider"
24 => "App\Providers\AppServiceProvider"
...
]
I'm really stuck on this one. I have no idea what could be wrong. Any nudging in the right direction is greatly appreciated.
Two possible fixes for that:
(Source: https://laracasts.com/discuss/channels/general-discussion/phpstorm-thinks-modelwhere-doesnt-exist-on-model-l5/replies/37661)
This article got me going with PHPStorm 2016.1.2, but it is one year older so I suppose it would work with older version.
https://blog.jetbrains.com/phpstorm/2015/01/laravel-development-using-phpstorm/
The only details that are probably missing, I found them on the plugin GitHub link:
After updating composer, add the service provider to the
providers
array inconfig/app.php
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
php artisan ide-helper:generate
Note: bootstrap/compiled.php has to be cleared first, so run php artisan clear-compiled before generating (and php artisan optimize after).
Source: https://github.com/barryvdh/laravel-ide-helper
i tried all the Answers, but after i include doctrine/dbal
for automatic phpDocs for models, the code autocomplete start to work because the automatic phpDocs for models added the @mixin \Eloquent
and this do the trick and more ;)
steps:
https://github.com/barryvdh/laravel-ide-helper
Require this package with composer using the following command:
composer require --dev barryvdh/laravel-ide-helper
After updating composer, add the service provider to the providers array in config/app.php
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
php artisan clear-compiled
php artisan ide-helper:generate
php artisan optimize
You can configure your composer.json to do this after each commit:
"scripts":{
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan ide-helper:generate",
"php artisan ide-helper:meta",
"php artisan optimize"
]
},
composer require doctrine/dbal
php artisan ide-helper:models
In addition to the IDE Helper, you must enable the Laravel Plugin per-project in PHPStorm.
Laravel Plugin
Enable plugin for this project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With