1. Go to this page and download the library: Download rpj/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/ */
rpj / daterangepicker example snippets
use Rpj\Daterangepicker\Daterangepicker;
public function filters(Request $request)
{
return [
new Daterangepicker('created_at'),
];
}
use Rpj\Daterangepicker\Daterangepicker;
use Rpj\Daterangepicker\DateHelper;
public function filters(Request $request)
{
return [
new Daterangepicker('users.created_at', DateHelper::THIS_WEEK, 'users.name', 'desc'),
];
}
use Rpj\Daterangepicker\Daterangepicker;
use Rpj\Daterangepicker\DateHelper;
use Carbon\Carbon;
public function filters(Request $request)
{
return [
(new Daterangepicker(
'users.created_at',
DateHelper::THIS_WEEK,
'users.name',
'desc'
))
->setRanges([
'Today' => [Carbon::today(), Carbon::today()],
'Yesterday' => [Carbon::yesterday(), Carbon::yesterday()],
'This week' => [Carbon::now()->startOfWeek(), Carbon::now()->endOfWeek()],
'This month' => [Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth()],
'Last month' => [Carbon::now()->subMonth()->startOfMonth(),Carbon::now()->subMonth()->endOfMonth()],
])
->setMaxDate(Carbon::today())
->setMinDate(Carbon::today()->endOfYear()),
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.