wip
This commit is contained in:
34
app/Modules/DateHelper/Repositories/DateHelperRepository.php
Normal file
34
app/Modules/DateHelper/Repositories/DateHelperRepository.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\DateHelper\Repositories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Modules\DateHelper\Models\DateHelper;
|
||||
|
||||
class DateHelperRepository
|
||||
{
|
||||
public static function monthsAsNumber(): array
|
||||
{
|
||||
$month = [];
|
||||
|
||||
for($m = 1;$m <= 12; $m++) {
|
||||
$month[] = str_pad($m, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
return $month;
|
||||
}
|
||||
|
||||
public static function yearsUntil(int $max = 50): array
|
||||
{
|
||||
$years = [];
|
||||
|
||||
$currentData = date('Y');
|
||||
|
||||
for ($i = 0; $i <= $max; $i++) {
|
||||
$years[] = intval($currentData) + $i;
|
||||
}
|
||||
|
||||
return $years;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user