Andrew Andrew - 1 year ago 231
PHP Question

PHPStorm auto-complete not working with Laravel 5

I'm using PHP Storm v8.0.3 with the latest version of Laravel.

I'm having trouble making the autocomplete work.

enter image description here

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.

enter image description here

I have included it in the
array as either




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.

enter image description here

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.

Answer Source

Two possible fixes for that:

  1. Make your models extend the \Eloquent facade instead of Illuminate\Database\Eloquent\Model.
  2. If you prefer to keep using the "Model" facade, you can make your own alias in config/app.php, then change "eloquent" to "model" in the config/ide-helper.php under extra. This will let ide-helper include all the methods from Illuminate\Database\Eloquent\Builder and Illuminate\Database\Query\Builder which is where the missing methods actually live.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download