laravel-ide-helper: Method where not found in App\Model
Model::where()
Results in the error “method where not found in App\Model”
Laravel 5.7 laravel-ide-helper ^2.4 php 7.2.8
I tried
php artisan clear-compiled
php artisan ide-helper:generate
php artisan ide-helper:meta
If I do
Model::query()->where()
It works fine
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 26 (2 by maintainers)
Does this help?
https://github.com/barryvdh/laravel-ide-helper/pull/700#issuecomment-451943526
Thanks, detailed protocol helps to understand your problem!
You did not generate the modes, i.e.
php artisan ide-helper:models
Because this command will write
_ide_helper_models.php
, will write a shallow duplicate of your model with phpdoc attached to the (duplicate|shallow) class. One of those phpdocs is@mixin \Eloquent
.Maybe you just forgot to run this command or don’t want to, you can also add the mixin manually, then it works:
PS: I recommend to use
php artisan ide-helper:models --write
to write that meta data directly onto your models.Guess it would be helpful to have Github “Discussions” for this project.
And maybe the readme needs some clarifications in this direction too 🤷♀️
@barryvdh as mentioned in https://github.com/barryvdh/laravel-ide-helper/issues/716#issuecomment-650489296, this particular issue can definitely be closed.
This works nowadays, it certainly does for me. Also other things mentioned, like local scopes, are supported too.
If there’s anything not working as expected, I suggest to search for existing issues or create new ones for each dedicated problem encountered.
@barryvdh I vote for closing this issue :}
Same problem in Laravel 5.5.44. Use version 2.4.3 solved.
Yes, it helped. I missed that because I thought it is optional and I dont like PHPDocs. Thank you very much!