So I've created a Message model:
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class Message extends Model
{
public function getName()
{
return $this->name;
}
public function setSortOrder($sortOrder)
{
$this->sort_order = $sortOrder;
return $this;
}
}
Run Code Online (Sandbox Code Playgroud)
And it seems to be working just fine - I've created some columns using migrations, loaded, and saved the model.
But my IDE (PHP Storm) doesn't seem to be recognizing some of the methods on the model - namely findOrFail. It does autocomplete findOrNew though.
Wondering whether something in lumen is pointing to a more stripped-down version of the base model class. But again the weird thing is that this method is working just fine when I run it - it's just the IDE that doesn't seem to be aware of it.
感谢@ joseph-silber关于PHPStorm的Laravel插件的提示.我刚刚发现并安装了它.我没有立即看到任何可以在那里启用docblock生成的设置.
在Laravel插件页面的注释中,它提到了"Laravel IDE Helper Generator".我做了搜索,发现了我安装的Haehnchen的Laravel插件.
这ide-helper:models为我的工匠命令列表以及其他一些选项添加了选项.我运行它,它确实在docblock中生成了一些方法但不是全部.
| 归档时间: |
|
| 查看次数: |
1078 次 |
| 最近记录: |