Overview
TheMultiDateFilter class provides a multi-date picker using Flatpickr, allowing users to select multiple individual dates. It applies an orWhereDate query for each selected date.
Creating a MultiDateFilter
Available Methods
label
format
Sets the date format for display and parsing.Default:
Date format string (PHP date format)
'Y-m-d'minDate
maxDate
key
default
Sets default date values for the filter.
The default value (array of date strings)
initialValue
Sets initial date values that are pre-applied when the table first loads.
The initial value (array of date strings)
filter
Provides a custom query callback to override the default filter behavior.
A closure that receives
Builder $query and mixed $value (array of date strings) and returns the modified BuildergroupClass / labelClass / inputClass
Sets CSS classes for the filter wrapper, label, or input element.
Value Structure
The filter value is an array of date strings:Value Normalization
Date values are automatically filtered to remove:- Non-string values
- Empty strings
- Dates outside minDate/maxDate bounds
['2023-12-15', '2024-06-15', '2025-01-15'], the normalized value will be ['2024-06-15'].
Default Behavior
By default,MultiDateFilter applies orWhereDate queries for each selected date:
Complete Examples
Basic Usage
Pre-selected Dates
Custom Filter Logic
Usage in Table Component
Real-world Example: Appointment Scheduling
Date Format Examples
UI Rendering
The filter renders a single input field that opens a Flatpickr calendar in multiple selection mode when clicked. Users can click multiple dates, and all selected dates are displayed in the input field separated by commas.Related Filters
- For single date selection, use DateFilter
- For date ranges, use DateRangeFilter