问题描述
我正在使用PHP Storm v8.0.3和最新版本的Laravel.
I'm using PHP Storm v8.0.3 with the latest version of Laravel.
我无法使自动完成功能正常工作.
I'm having trouble making the autocomplete work.
如上图所示.
我已经按照git提供的自述文件安装了 barryvdh ide-helper .安装期间我没有收到任何错误.
I have installed barryvdh ide-helper, following the readme he provides on git. I haven't received any errors during its installation.
我已经将其包含在providers
数组中
I have included it in the providers
array as either
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider'
或
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider:class
(据我所知)没有任何区别.
It didn't make any difference(as far as I can tell).
我还安装了Laravel插件.
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:
- 使您的模型扩展\ Eloquent外观,而不是照亮\数据库\口才\模型.
- 如果您希望继续使用在模型"外观上,您可以在config/app.php中创建自己的别名,然后在下面的config/ide-helper.php中将雄辩"更改为模型"额外的.这将使ide-helper包含来自的所有方法照亮\数据库\口才\生成器和Illuminate \ Database \ Query \ Builder这是缺少的方法实际生活.
- Make your models extend the \Eloquent facade instead ofIlluminate\Database\Eloquent\Model.
- 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 underextra. This will let ide-helper include all the methods fromIlluminate\Database\Eloquent\Builder andIlluminate\Database\Query\Builder which is where the missing methodsactually live.
这篇关于PHPStorm自动完成功能不适用于Laravel 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!