Filter::make('application_submitted_at')->form([ DatePicker::make('from'), DatePicker::make('until'),])->query(function (Builder $query, array $data): Builder { return $query ->when( $data['from'], fn (Builder $query, $date): Builder => $query->whereDate('application_submitted_at', '>=', $date), ) ->when( $data['until'], fn (Builder $query, $date): Builder => $query->whereDate('application_submitted_at', '<=', $date), ); });