user继承自eloquentmodel类,在lumen5.3框架下,phpstorm框架下面这段代码
<code>public function view($id){
User::all();
User::find($id);
return User::findOrFail($id);
}
</code>phpstorm报错:
Easily find JSON paths within JSON objects using our intuitive Json Path Finder
30
<code>Method 'find' not found in \App\User Method 'findOrFail' not found in \App\User。</code>
all 方法没问题。
我把框架改成 lumen 5.0.3,不会报这个错。
是框架方法改了吗,那在lumen5.3该怎么写。
user继承自eloquentmodel类,在lumen5.3框架下,phpstorm框架下面这段代码
<code>public function view($id){
User::all();
User::find($id);
return User::findOrFail($id);
}
</code>phpstorm报错:
<code>Method 'find' not found in \App\User Method 'findOrFail' not found in \App\User。</code>
all 方法没问题。
我把框架改成 lumen 5.0.3,不会报这个错。
是框架方法改了吗,那在lumen5.3该怎么写。
这篇文章看过了吗 貌似想用Eloquent要单独启用
如果你想要使用Eloquent ORM,应该取消bootstrap/app.php文件中$app->withEloquent()调用前的注释。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号