User inherits from the EloquentModel class. Under the lumen5.3 framework, the code below is in the phpstorm framework
<code>public function view($id){ User::all(); User::find($id); return User::findOrFail($id); } </code>
phpstorm error:
<code>Method 'find' not found in \App\User Method 'findOrFail' not found in \App\User。</code>
all method is fine.
I changed the framework to lumen 5.0.3 and this error will not be reported.
Has the framework method been changed? How to write it in lumen5.3?
User inherits from the EloquentModel class. Under the lumen5.3 framework, the code below is in the phpstorm framework
<code>public function view($id){ User::all(); User::find($id); return User::findOrFail($id); } </code>
phpstorm error:
<code>Method 'find' not found in \App\User Method 'findOrFail' not found in \App\User。</code>
all method is fine.
I changed the framework to lumen 5.0.3 and this error will not be reported.
Has the framework method been changed? How to write it in lumen5.3?
Have you read this article? It seems that if you want to use Eloquent, you need to enable it separately
If you want to use Eloquent ORM, you should uncomment the $app->withEloquent()
call in the bootstrap/app.php
file.