You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make sure you add the following to your `tailwind.config.js` file. You will need to create a [theme](https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme) if you haven't already.
If you want to use a range slider instead of an input field you can enable it.
68
+
69
+
```php
70
+
PriceFilter::make('price')
71
+
->slider()
72
+
```
73
+
74
+
Set the minimum and maximum values for the filter.
75
+
76
+
```php
77
+
PriceFilter::make('price')
78
+
->min(100)
79
+
->max(1000)
65
80
```
66
81
82
+
If you want to grab the min, max values from the database you can use the `min` and `max` methods. Here is an example of how you can use it with caching.
83
+
84
+
> [!NOTE]
85
+
> Flexible cache is a caching helper method that is introduced in Laravel 11.23.0, you can also use the default cache function.
86
+
87
+
```php
88
+
->min(fn () => Cache::flexible('min_price', [30, 60], function () {
89
+
return Order::min('price') / 100; // Divide by 100 if you saved it as cents
90
+
}))
91
+
````
92
+
93
+
```php
94
+
->max(fn () => Cache::flexible('max_price', [30, 60], function () {
95
+
return Order::max('price') / 100; // Divide by 100 if you saved it as cents
96
+
}))
97
+
```
98
+
The step value is used to determine the interval between each value in the filter.
99
+
100
+
```php
101
+
PriceFilter::make('price')
102
+
->step(100)
103
+
```
104
+
105
+
By default, the label will be the name of the filter, for example `PriceFilter::make('total_price')` will have a label of `Total price to` and `Total price from`. You can change the label to whatever you want.
106
+
107
+
```php
108
+
PriceFilter::make('price')
109
+
->label('Shipping price')
110
+
```
111
+
112
+
67
113
## Changelog
68
114
69
115
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
0 commit comments