This commit is contained in:
Adrian Hopek
2022-01-21 08:45:42 +01:00
parent 652587dbf1
commit a62a428781
12 changed files with 420 additions and 8 deletions

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Toby\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
* @property User $user
* @property YearPeriod $yearPeriod
* @property bool $has_vacation
* @property int $days
*/
class VacationLimit extends Model
{
use HasFactory;
protected $casts = [
"has_vacation" => "boolean",
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function yearPeriod(): BelongsTo
{
return $this->belongsTo(YearPeriod::class);
}
}

View File

@@ -7,10 +7,13 @@ namespace Toby\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;
/**
* @property int $id
* @property int $year
* @property Collection $vacationLimits
*/
class YearPeriod extends Model
{
@@ -27,4 +30,9 @@ class YearPeriod extends Model
return $year;
}
public function vacationLimits(): HasMany
{
return $this->hasMany(VacationLimit::class);
}
}