Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PhpStorm (Laravel 8) all standart eloquent methods not found on one model, but available on another (no code hinting)

(I have checked previous posts regarding this situation)

On the pictures below you see code from the SAME file "StripeController.php"

Both Classes/Models (StripeEvent and Transaction) extends Model, has

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

namespace App\Models, and uses:

use Illuminate\Database\Eloquent\Factories\HasFactory;

use Illuminate\Database\Eloquent\Model;

This line is NOT present in any of those Models (use Illuminate\Database\Eloquent\Builder)

No DOC blocs are present in both Classes/Models.

Here PhpStorm says that "firstWhere" method not found on StripeEvent model:
enter image description here

But on previous line (in the same file) with Transaction model PhpStorm finds this method:
enter image description here

I tried to create other new models, but problem remains the same. Methods are recognized by PhpStorm only for old/previously created models, but NOT recognized for new ones.

I suspect that there might be some config or helper cache that should be re-generated.

Any ideas how to fix it and make PhpStorm code hint and not underline eloquent methods?

>Solution :

If you are using Laravel Idea in your PhpStorm, you need to click "Laravel / Generate Helper Code" in the top menu. Also, if you have Laravel IDE Helper package in your laravel app, you can use the following commands:

php artisan ide-helper:generate
php artisan ide-helper:models
php artisan ide-helper:meta
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading