Changes to holidays and the overlap between this year and the previous year
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Holiday extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'date',
|
||||
'title',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'date' => 'date',
|
||||
];
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -111,16 +111,17 @@ class User extends Authenticatable
|
||||
if (!$date) {
|
||||
continue;
|
||||
}
|
||||
$month = $date->format('%B');
|
||||
$key = sprintf('%04d-%02d', $date->getYear(), $date->getMonth());
|
||||
|
||||
if (!isset($result[$month])) {
|
||||
$result[$month] = [];
|
||||
if (!isset($result[$key])) {
|
||||
$result[$key] = [];
|
||||
}
|
||||
|
||||
$result[$month][] = $att;
|
||||
$result[$key][] = $att;
|
||||
}
|
||||
}
|
||||
|
||||
krsort($result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user