Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

auroralabs's avatar

List Tabs do not Update

I would like the getTabs function in the ListDelivery.php to updated according to the filters selected in the DeliveryResource.php file. For example when the table results change to show the results based on the filter ie warehouse_id changes to another Warehouse I would like the tabs to recalculate the respective badge totals:

DeliveryResource.php

->filters([
    SelectFilter::make('warehouse_id')
        ->label('Filter by Warehouse')
        ->options(Warehouse::all()->pluck('name', 'id'))
        ->query(function (Builder $query, array $data) {
            if (isset($data['value'])) {
                $query->where('warehouse_id', $data['value']);
            }
            return $query->orderBy('delivery', 'asc');
        }),
    Filter::make('created_at')
        ->label('Filter by Dates')
        ->form([
            DatePicker::make('deliveries_from'),
            DatePicker::make('deliveries_until'),
        ])
        ->query(function (Builder $query, array $data): Builder {
            return $query
                ->when(
                    $data['deliveries_from'],
                    fn (Builder $query, $date): Builder => $query->whereDate('created_at', '>=', $date),
                )
                ->when(
                    $data['deliveries_until'],
                    fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
                );
        }),
])

ListDelivery.php

0 likes
0 replies

Please or to participate in this conversation.