kpolicar / nova-date-range
Custom date range picker field for Laravel Nova
Installs: 151 029
Dependents: 3
Suggesters: 0
Security: 0
Stars: 26
Watchers: 1
Forks: 16
Open Issues: 9
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-11-24 20:06:51 UTC
README
Description
This package adds a new custom daterange picker field to Laravel Nova.
Example
Usage
To add a new daterange field, simply add it to your array of fields, providing the "from-to" attributes as parameters.
namespace App\Nova; // ... use Kpolicar\DateRange\DateRange; class Reservation extends Resource { // ... public function fields(Request $request) { return [ // ... DateRange::make(['From', 'To']), // or DateRange::make('Between', ['from', 'to']), // ... ]; } }
You should also ensure the Eloquent model that your resource represents is casting the used attributes as dates.
namespace App\Nova; // ... class Reservation extends Model { protected $dates = [ 'from', 'to' ]; }
Installation
You can install this package in to a Laravel app that uses Nova via composer:
composer require kpolicar/nova-date-range
License
The MIT License. Please see License File for more information.