Table tabs from database
I looked at the demo application and see the below tab on the table but instead of passing static value i want to retrieve fom the database.
:
public function getTabs(): array
{
return [
null => ListRecords\Tab::make('All'),
'new' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'new')),
'processing' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'processing')),
'shipped' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'shipped')),
'delivered' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'delivered')),
'cancelled' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'cancelled')),
];
}
instead of new, processing, etc. i want to get a branch name
4 Replies
@Bloom
getTabs()
just returns an array so you can do whatever you there. So you could do something like:
Adjust and refactor as needed of course.Thank you it is working, but i want to return all the data also, can you help me with that
Lots of ways but one way would be:
So instead of starting with an empty array, just start with your all tab.
Thank you it worked