Answers for "add day carbon laravel"

PHP
1

laravel carbon human readable

$comment->created_at->diffForHumans();
Posted by: Guest on May-09-2020
0

laravel carbon created_at date in current month

public function myMonthApts()
{
        return $this->appointments()
                        ->whereIn('status_id', [3,4])
                        ->whereYear('created_at', Carbon::now()->year)
                        ->whereMonth('created_at', Carbon::now()->month)
                        ->count();
}
Posted by: Guest on September-13-2021
-2

get array of last 3 dates with carbon

$period = CarbonPeriod::create('2018-06-14', '2018-06-20');

// Iterate over the period
foreach ($period as $date) {
    echo $date->format('Y-m-d');
}

// Convert the period to an array of dates
$dates = $period->toArray();
Posted by: Guest on August-16-2020

Browse Popular Code Answers by Language