当我做以下事情时: $ solicitud = Solicitud :: find($ id); $ extras = $ solicitud-> extras();
PHPstorm无法将$ solicitud识别为Solicitud模型,并在extras()方法中显示警告:“在Illuminate / Support / Collection | static中找不到方法附加内容”
如果我使用@var注释,警告会消失,但是有一种自动修复方法吗?
答案 0 :(得分:0)
我以前使用Laravel 4遇到过这个问题,当时模型只是扩展\Eloquent
,虽然编程上很好,但PHPStorm并不知道\Eloquent
是什么在laravel运行其bootstraping以在配置文件中注册别名后进行设置。
在你的模特中你只需要扩展Illuminate\Database\Eloquent\Model
。
use Illuminate\Database\Eloquent\Model as Eloquent;
class Solicitud extends Eloquent {
// Usual model code
}