laravel-ide-helper
laravel-ide-helper copied to clipboard
Model methods are missing with `--write-mixin`
Versions:
- ide-helper Version: 2.12.3
- Laravel Version: 9.9.0
- PHP Version: 8.1.3
Description:
Model methods are missing when using --write-mixin
With --write-mixin |
Without --write-mixin |
|---|---|
![]() |
![]() |
Basic model methods like find appear to be missing when using --write-mixin. They work correctly without --write-mixin
I've reproduced the following steps in this repo: https://github.com/ptrkcsk/laravel-ide-helper-models
There are two differences in _ide_helper_models.php between using --write-mixin and not, as seen here: https://github.com/ptrkcsk/laravel-ide-helper-models/compare/write-mixin...no-write-mixin
- The generated class has
@mixin IdeHelperUser. This looks like a mistake to me becauseIdeHelperUserappears to not exist - The generated class extends
\Eloquent. I suspect this is the problem, because with--write-mixin, the generated class is missing the methods provided by\Eloquent
Steps To Reproduce:
-
Generate facades helper and models helper with
--write-mixin:vendor/bin/sail artisan ide-helper:generate vendor/bin/sail artisan ide-helper:models --write-mixin -
Try to use a model's
findmethod, e.g.User::find(). Notice "Method 'find' not found..." warning in IDE -
Re-generate models helper without
--write-mixin:vendor/bin/sail artisan ide-helper:models -
Try to use a model's
findmethod again. Noticefindmethod is now found
I faced with the same issue

