amidesfahani / nova-persian-date-filter
Laravel Nova Persian Date filter field.
Installs: 37
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Vue
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-11-12 02:03:27 UTC
README
Nova filter that displays a Persian Date Range Picker instead of a select.
Install
Run this command in your nova project:
composer require amidesfahani/nova-persian-date-filter
How to use
Just use DateRangeFilter class instead of Filter
use Amid\NovaPersianDateFilter\NovaPersianDateFilter; class DateRange extends NovaPersianDateFilter { public function apply(Request $request, $query, $value) { $from = Carbon::parse($value[0])->startOfDay(); $to = Carbon::parse($value[1])->endOfDay(); return $query->whereBetween('created_at', [$from, $to]); } /** * Get the filter's available options. * * @param \Illuminate\Http\Request $request * @return array */ // public function options(Request $request) // { // return [ // 'firstDayOfWeek' => 0, // 'mode' => 'range', // 'enableTime' => false, // 'enableSeconds' => false, // 'twelveHourTime' => false // ]; // } }
Customization
Use fluent interface to configure your DateRange filter
(new DateRange)->placeholder("Placeholder")->dateFormat("m d Y")