26 lines
874 B
PHP
26 lines
874 B
PHP
<?php
|
|
|
|
use Carbon\Carbon;
|
|
|
|
require_once realpath(dirname(__FILE__) . '/TestCase.php');
|
|
$date = new DateTime('2018-10-31');
|
|
$date->modify('-1 month');
|
|
echo $date->format('Y-m-d');
|
|
|
|
$res = Carbon::parse('2018-10')->endOfMonth()->subMonth();
|
|
|
|
dd($res);
|
|
|
|
$conditions = [
|
|
'starttime' => Carbon::parse('2018-10-01')->startOfDay(),
|
|
'endtime' => Carbon::parse('2018-10-31')->startOfDay(),
|
|
];
|
|
|
|
$res = \DB::connection('mongo')->table('tblCard')->where(function ($query) use ($conditions) {
|
|
$query->where('exPCodes.cDate', '>=', $conditions['starttime'])->where('exPCodes.cDate', '<=', $conditions['endtime'])->where('oDate', 'exists', false);
|
|
})->orWhere(function ($query) use ($conditions) {
|
|
$query->where('exPCodes.oDate', '>=', $conditions['starttime'])->where('exPCodes.oDate', '<=', $conditions['endtime'])->where('pType', 0);
|
|
})->first();
|
|
|
|
dd($res['exPCodes']);
|