test
This commit is contained in:
parent
7aa9a52f8c
commit
7737b9e9c2
@ -6,6 +6,7 @@ namespace Toby\Eloquent\Observers;
|
||||
|
||||
use Toby\Eloquent\Helpers\YearPeriodRetriever;
|
||||
use Toby\Eloquent\Models\User;
|
||||
use Toby\Eloquent\Models\YearPeriod;
|
||||
|
||||
class UserObserver
|
||||
{
|
||||
@ -15,8 +16,12 @@ class UserObserver
|
||||
|
||||
public function created(User $user): void
|
||||
{
|
||||
$yearPeriods = YearPeriod::all();
|
||||
|
||||
foreach ($yearPeriods as $yearPeriod) {
|
||||
$user->vacationLimits()->create([
|
||||
"year_period_id" => $this->yearPeriodRetriever->current()->id,
|
||||
"year_period_id" => $yearPeriod->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user