#20 - wip
This commit is contained in:
		| @@ -23,6 +23,7 @@ use Toby\Enums\EmploymentForm; | ||||
|  * @property EmploymentForm $employment_form | ||||
|  * @property Carbon $employment_date | ||||
|  * @property Collection $vacationLimits | ||||
|  * @property Collection $vacationRequests | ||||
|  */ | ||||
| class User extends Authenticatable | ||||
| { | ||||
| @@ -46,6 +47,11 @@ class User extends Authenticatable | ||||
|         return $this->hasMany(VacationLimit::class); | ||||
|     } | ||||
|  | ||||
|     public function vacationRequests(): HasMany | ||||
|     { | ||||
|         return $this->hasMany(VacationRequest::class); | ||||
|     } | ||||
|  | ||||
|     public function scopeSearch(Builder $query, ?string $text): Builder | ||||
|     { | ||||
|         if ($text === null) { | ||||
|   | ||||
							
								
								
									
										33
									
								
								app/Models/VacationRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								app/Models/VacationRequest.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Toby\Models; | ||||
|  | ||||
| use Illuminate\Database\Eloquent\Factories\HasFactory; | ||||
| use Illuminate\Database\Eloquent\Model; | ||||
| use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||||
| use Illuminate\Support\Carbon; | ||||
| use Toby\Enums\VacationType; | ||||
|  | ||||
| /** | ||||
|  * @property int $id | ||||
|  * @property VacationType $type | ||||
|  * @property Carbon $from | ||||
|  * @property Carbon $to | ||||
|  * @property string $comment | ||||
|  * @property User $user | ||||
|  */ | ||||
| class VacationRequest extends Model | ||||
| { | ||||
|     use HasFactory; | ||||
|  | ||||
|     protected $casts = [ | ||||
|         "type" => VacationType::class, | ||||
|         "from" => "date", | ||||
|         "to" => "date", | ||||
|     ]; | ||||
|  | ||||
|     public function user(): BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(User::class); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user