56 lines
1.2 KiB
PHP
Executable File
56 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\VacationPeriodFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property int $marker_id
|
|
* @property Carbon $start_date
|
|
* @property Carbon $end_date
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
*/
|
|
#[Fillable(['user_id', 'marker_id', 'start_date', 'end_date'])]
|
|
class VacationPeriod extends Model
|
|
{
|
|
/** @use HasFactory<VacationPeriodFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @return BelongsTo<User, $this>
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<Marker, $this>
|
|
*/
|
|
public function marker(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Marker::class);
|
|
}
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'start_date' => 'date:Y-m-d',
|
|
'end_date' => 'date:Y-m-d',
|
|
];
|
|
}
|
|
}
|