Laravel Livewire Tables Documentation

🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.

This is the documentation for v3. You can switch versions in the menu at the top. Check your current version with the following command:

composer show rappasoft/laravel-livewire-tables

Date Filters

Date filters are HTML date elements.

1use Rappasoft\LaravelLivewireTables\Views\Filters\DateFilter;
2 
3public function filters(): array
4{
5 return [
6 DateFilter::make('Verified From'),
7 ];
8}

Date filters have configs to set min and max, to set the format for the Filter Pills, and to set a placeholder value

1public function filters(): array
2{
3 return [
4 DateFilter::make('Verified From')
5 ->config([
6 'min' => '2020-01-01', // Earliest Acceptable Date
7 'max' => '2021-12-31', // Latest Acceptable Date
8 'pillFormat' => 'd M Y', // Format for use in Filter Pills
9 'placeholder' => 'Enter Date', // A placeholder value
10 ])
11 ];
12}

setFilterDefaultValue

Date filters also support the setFilterDefaultValue() method, which must be a valid date in the "Y-m-d" format. This will apply as a default until removed.

1public function filters(): array
2{
3 return [
4 DateFilter::make('Verified From')
5 ->config([
6 'min' => '2020-01-01',
7 'max' => '2023-12-31',
8 'pillFormat' => 'd M Y',
9 ])->setFilterDefaultValue('2023-08-01')
10 ];
11}

setPillsLocale

Date Filters also support the setPillsLocale method, which allows you to set a locale for use in generating the Filter Pills values

1public function filters(): array
2{
3 return [
4 DateFilter::make('Verified From')
5 ->setPillsLocale('fr ') // Use French localisation for the Filter Pills values
6 ->config([
7 'min' => '2020-01-01', // Earliest Acceptable Date
8 'max' => '2021-12-31', // Latest Acceptable Date
9 'pillFormat' => 'd M Y', // Format for use in Filter Pills
10 'placeholder' => 'Enter Date', // A placeholder value
11 ])
12 ];
13}