<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use CarbonCarbon;
class DateController extends Controller
{
public function index()
{
$currentDateTime = Carbon::now();
$newDateTime = Carbon::now()->addMonth();
print_r($currentDateTime);
print_r($newDateTime);
}
}
use CarbonCarbon;
Carbon::now()->format("l") // today's day name. example: Sunday
public function myMonthApts()
{
return $this->appointments()
->whereIn('status_id', [3,4])
->whereYear('created_at', Carbon::now()->year)
->whereMonth('created_at', Carbon::now()->month)
->count();
}
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use CarbonCarbon;
class DateController extends Controller
{
public function index()
{
$currentDateTime = Carbon::now();
$newDateTime = Carbon::now()->addYear();
print_r($currentDateTime);
print_r($newDateTime);
}
}
$period = CarbonPeriod::create($startDate, $endDate);
foreach($period as $date)
{
$dates[] = $date->format('d-m-Y');
}