PHP code example of pos-lifestyle / laravel-nova-date-range-filter

1. Go to this page and download the library: Download pos-lifestyle/laravel-nova-date-range-filter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pos-lifestyle / laravel-nova-date-range-filter example snippets


use Illuminate\Http\Request;
use PosLifestyle\DateRangeFilter\DateRangeFilter;

class CustomResource extends Resource
{
    public function filters(Request $request): array
    {
        return [
            new DateRangeFilter(),
        ];
    }
}

use Illuminate\Http\Request;
use PosLifestyle\DateRangeFilter\DateRangeFilter;
use PosLifestyle\DateRangeFilter\Enums\Config;

class CustomResource extends Resource
{
    public function filters(Request $request): array
    {
        return [
            new DateRangeFilter('Created at', 'created_at', [
                Config::ALLOW_INPUT => false,
                Config::DATE_FORMAT => 'Y-m-d',
                Config::DEFAULT_DATE => ['2019-06-01', '2019-06-30'],
                Config::DISABLED => false,
                Config::ENABLE_TIME => false,
                Config::ENABLE_SECONDS => false,
                Config::FIRST_DAY_OF_WEEK => 0,
                Config::LOCALE => 'default',
                Config::MAX_DATE => '2019-12-31',
                Config::MIN_DATE => '2019-01-01',
                Config::PLACEHOLDER => __('Choose date range'),
                Config::SHORTHAND_CURRENT_MONTH => false,
                Config::SHOW_MONTHS => 1,
                Config::TIME24HR => false,
                Config::WEEK_NUMBERS => false,
            ]),
        ];
    }
}