#48 - deployment

This commit is contained in:
Adrian Hopek
2022-03-08 11:28:49 +01:00
parent 0c32410767
commit d5ba1de403
14 changed files with 102 additions and 102 deletions

View File

@@ -4,19 +4,19 @@ declare(strict_types=1);
namespace Toby\Eloquent\Observers;
use Toby\Eloquent\Helpers\YearPeriodRetriever;
use Toby\Eloquent\Models\User;
use Toby\Eloquent\Models\YearPeriod;
class UserObserver
{
public function __construct(
protected YearPeriodRetriever $yearPeriodRetriever,
) {}
public function created(User $user): void
{
$user->vacationLimits()->create([
"year_period_id" => $this->yearPeriodRetriever->current()->id,
]);
$yearPeriods = YearPeriod::all();
foreach ($yearPeriods as $yearPeriod) {
$user->vacationLimits()->create([
"year_period_id" => $yearPeriod->id,
]);
}
}
}