migrate to gtea from bistbucket

This commit is contained in:
2026-03-15 17:08:23 +07:00
commit 129ca2260c
3716 changed files with 566316 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Traits;
use Carbon\Carbon;
trait DateRangeTrait
{
public function applyDateRange(?string $duration, $fromDate = null, $toDate = null): array
{
return match ($duration) {
'today' => [Carbon::today(), Carbon::today()],
'yesterday' => [Carbon::yesterday(), Carbon::yesterday()],
'last_seven_days' => [Carbon::today()->subDays(6), Carbon::today()],
'last_thirty_days' => [Carbon::today()->subDays(29), Carbon::today()],
'current_month' => [Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth()],
'last_month' => [Carbon::now()->subMonth()->startOfMonth(), Carbon::now()->subMonth()->endOfMonth()],
'current_year' => [Carbon::now()->startOfYear(), Carbon::now()->endOfYear()],
'custom_date' => $fromDate && $toDate ? [Carbon::parse($fromDate), Carbon::parse($toDate)] : [null, null],
default => [null, null],
};
}
}