Closed tehomen closed 2 years ago
Nothing give me withExpression or any of the methods provided with the builder from the package, but the methods do work, but they don't give auto complete which is a pain since I want to chain methods onto the methods from this package.
I have looked into this in the past, but I didn't find a solution. Do you know if laravel-ide-helper
offers a way to register the package's custom methods? Or another package that registers its methods?
@tehomen did you find any solution to this? I'm getting
phpstan: Call to an undefined method Illuminate\Database\Query\Builder::withRecursiveExpression().
when using
return DB::table('tree')
->withRecursiveExpression('tree', $query)
->get();
I've been facing the same issue. It can't be fixed by laravel-ide-helper
because this package only deals with Facades and Models.
Here the Larastan-friendly solution:
/** @var Staudenmeir\LaravelCte\Query\Builder */
$cteBuilder = $this->builder->getQuery();
$cteBuilder->withExpression(/* your code here */);
It is not ideal though, because it relies on PHPdoc comments.
I've tried manually adding the service provider and calling "php artisan package:discover" before calling the ide-helper generate command, none of which add auto-complete for this package. Also tried deleing the _ide_helper.php file then doing both of those steps mentioned and that also doesn't help. They show methods inside of the generated file like function query which returns a builder, but nothing gives me the auto-complete, not DB:: or DB::query or from a query builder or eloquent builder. Only thing that works is for eloquent models add the trait, but that is not the only use I need this package for.