Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm method not found in class

I'm working on a project using Laravel 5.5 and I'm using PhpStorm as IDE but it shows me

"Method 'table' not found in \Illuminate\Support\Facades\DB..."
"Referenced method is not found in subject class.. "

The code however is working perfectly but still want to know the perfect syntax.

like image 379
Abdullahi Avatar asked Jul 28 '26 03:07

Abdullahi


1 Answers

even if you install the barryvdh/laravel-ide-helper the problem persist, there's a quick solution for this problem, if you look in the /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php class and Add this PhpDoc

/**
 * @mixin \Eloquent
 * @mixin \Illuminate\Database\Eloquent\Builder
 */

PhpStorm will now recognize all the Query building methods for all your models

like image 99
Alejandro Sulbaran Avatar answered Jul 30 '26 19:07

Alejandro Sulbaran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!