<?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,
]),
];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.