The lumen5.3EloquentModel class does not have methods such as find, findOrFail, where, and first.

Source: Internet
Author: User
The User inherits from the EloquentModel class. in the framework of lumen5.3, the code {code...} in the phpstorm framework reports an error in phpstorm: {code...} the all method is correct. If I change the framework to lumen5.0.3, this error will not be reported. Is the framework method changed? what should I do in lumen5.3? the User inherits from the EloquentModel class. in the framework of lumen5.3, the code below the phpstorm framework

public function view($id){        User::all();        User::find($id);        return  User::findOrFail($id);}

Phpstorm error:

Method 'find' not found in \App\UserMethod 'findOrFail' not found in \App\User。

The all method is fine.

If I change the framework to lumen 5.0.3, this error will not be reported.
Is the framework method changed? what should I do in lumen5.3.

Reply content:

The User inherits from the EloquentModel class. in the framework of lumen5.3, the code below the phpstorm framework

public function view($id){        User::all();        User::find($id);        return  User::findOrFail($id);}

Phpstorm error:

Method 'find' not found in \App\UserMethod 'findOrFail' not found in \App\User。

The all method is fine.

If I change the framework to lumen 5.0.3, this error will not be reported.
Is the framework method changed? what should I do in lumen5.3.

Have you read this article? it seems you want to use Eloquent to enable it separately?

If you want to use Eloquent ORM, cancelbootstrap/app.phpFile$app->withEloquent()Comments before the call.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.