filter problem

I'm getting an error when I filter for my signed enrolments: nothing is displayed.
protected function getTableFilters(): array
{
return [
Filter::make('is_signed')->label('Archive')->query(function (Builder $query, array $data): Builder {
if ($data['isActive'] === true) {
return $query->where('is_signed', true);
}
return $query;
}),
];
}
protected function getTableFilters(): array
{
return [
Filter::make('is_signed')->label('Archive')->query(function (Builder $query, array $data): Builder {
if ($data['isActive'] === true) {
return $query->where('is_signed', true);
}
return $query;
}),
];
}
10 Replies
bernhard
bernhard16mo ago
Thats a bit less information: 1) What does "nothing is displayed" mean? You mean an empty table / no data? 2) Empty, only after clicking the filter, right? 3) Just to make sure: Have you dd(data['isActive']) ? 4) Can you check the query? Maybe with telescope or debugbar?
Becker Maxime
Becker MaximeOP16mo ago
1) $query->where('is_signed', true)->get(), return 2 items but my table finds no items 2) yes 3) $data['isActive] = true
bernhard
bernhard16mo ago
Ok, and which query is created by the query builder? Can you check it with telescope or debugbar?
Becker Maxime
Becker MaximeOP16mo ago
Becker Maxime
Becker MaximeOP16mo ago
Is that enough for you, or do you really want me to go through telescope?
bernhard
bernhard16mo ago
Lol. I meant the real and final SQL query, which you would find in telescope. Where did you dd this? In the query function of the filter? Maybe you could try at least dd($query->getQuery());
Becker Maxime
Becker MaximeOP16mo ago
select * from emargement where is_signed = true;
Becker Maxime
Becker MaximeOP16mo ago
bernhard
bernhard16mo ago
and dd($query->toRawSql()); But as I said, the most important thing would be the final query from telescope/debugbar Because here you only get the query till the current filter. Maybe there is something afterwars (another filter or whatever) adding something which excludes rows
Becker Maxime
Becker MaximeOP16mo ago
ok I'll try with telescope/debugbar
Want results from more Discord servers?
Add your server