closure must be an instance of App\Tables\Builder, instance of Illuminate\Database\Eloquent\Builder given
oterminramiro opened this issue · 1 comments
oterminramiro commented
Hi i am building a simple crud in laravel 8 and this is what happens when i try to do a query like the ones in the docs:
Argument 1 passed to App\Tables\UsersTable::App\Tables{closure}() must be an instance of App\Tables\Builder, instance of Illuminate\Database\Eloquent\Builder given, called in /var/www/html/vendor/okipa/laravel-table/src/Traits/Table/HasAdditionalQueries.php on line 25
It works by removing Builder from this:
->query(function (Builder $query) {
$query->where('category_id', 1);
})
Okipa commented
Hi @oterminramiro,
You're supposed to add use Illuminate\Database\Eloquent\Builder;
in your imports to make this work, as you can see it in the doc example here: https://github.com/Okipa/laravel-table#advanced-configuration-example.