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
bernhard11mo 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 Maxime11mo ago
1) $query->where('is_signed', true)->get(), return 2 items but my table finds no items 2) yes 3) $data['isActive] = true
bernhard
bernhard11mo ago
Ok, and which query is created by the query builder? Can you check it with telescope or debugbar?
Becker Maxime
Becker Maxime11mo ago
Becker Maxime
Becker Maxime11mo ago
Is that enough for you, or do you really want me to go through telescope?
bernhard
bernhard11mo 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 Maxime11mo ago
select * from emargement where is_signed = true;
Becker Maxime
Becker Maxime11mo ago
bernhard
bernhard11mo 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 Maxime11mo ago
ok I'll try with telescope/debugbar