* test * #48 - deployment * #48 - fixes * #48 - prod assets * #48 - readme for heroku deployment * #48 - fix * #48 - ecs fix * #48 - fix * #48 - fix * #48 - cr fix * #48 - remove predis dependency
		
			
				
	
	
		
			23 lines
		
	
	
		
			435 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			435 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| declare(strict_types=1);
 | |
| 
 | |
| namespace Toby\Eloquent\Observers;
 | |
| 
 | |
| use Toby\Eloquent\Models\User;
 | |
| use Toby\Eloquent\Models\YearPeriod;
 | |
| 
 | |
| class UserObserver
 | |
| {
 | |
|     public function created(User $user): void
 | |
|     {
 | |
|         $yearPeriods = YearPeriod::all();
 | |
| 
 | |
|         foreach ($yearPeriods as $yearPeriod) {
 | |
|             $user->vacationLimits()->create([
 | |
|                 "year_period_id" => $yearPeriod->id,
 | |
|             ]);
 | |
|         }
 | |
|     }
 | |
| }
 |