PHP code example of huo-zi / laravel-admin-ext-daterangepicker
1. Go to this page and download the library: Download huo-zi/laravel-admin-ext-daterangepicker 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/ */
huo-zi / laravel-admin-ext-daterangepicker example snippets
'extensions' => [
'daterangepicker' => [
'enable' => true,
// 可以在这里配置全局的daterangepicker配置
'config' => [
]
]
]
$form->daterangepicker('date_field', 'date_label');
$form->daterangepicker(['date_start_field', 'date_end_field'], 'date_label');
$form->daterangepicker(['date_start_field', 'date_end_field'], 'date_label')->ranges(<<<RANGES
{
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
RANGES);
$form->daterangepicker(...)->format('YYYY-MM-DD');
$form->daterangepicker(...)->single(false);
$form->daterangepicker(...)->option('option_name', 'option_value');
$form->daterangepicker(...)->option('option_parent.option_child', 'option_value');
$filter->daterangepicker('filter_field', 'filter_label');
$filter->daterangepicker('filter_field', 'filter_label')->single();
$filter->daterangepicker('filter_field', 'filter_label', function($query) {
$query->where(...);
});
bash
php artisan vendor:publish --tag=laravel-admin-daterangepicker