User继承自EloquentModel类,在lumen5.3框架下,phpstorm框架下面这段代码
public function view($id){ User::all(); User::find($id); return User::findOrFail($id); }
phpstorm报错:
Method 'find' not found in \App\User Method 'findOrFail' not found in \App\User。
all 方法没问题。
我把框架改成 lumen 5.0.3,不会报这个错。是框架方法改了吗,那在lumen5.3该怎么写。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
如果你想要使用Eloquent ORM,应该取消bootstrap/app.php文件中$app->withEloquent()调用前的注释。