- Crowd Types + Persons CRUD (73 tests) - Festival Sections + Time Slots + Shifts CRUD met assign/claim flow (84 tests) - Invite Flow + Member Management met InvitationService (109 tests) - Schema v1.6 migraties volledig uitgevoerd - DevSeeder bijgewerkt met crowd types voor testorganisatie
58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
final class TimeSlot extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasUlids;
|
|
|
|
protected $fillable = [
|
|
'event_id',
|
|
'name',
|
|
'person_type',
|
|
'date',
|
|
'start_time',
|
|
'end_time',
|
|
'duration_hours',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'date' => 'date',
|
|
'person_type' => 'string',
|
|
];
|
|
}
|
|
|
|
public function event(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Event::class);
|
|
}
|
|
|
|
public function shifts(): HasMany
|
|
{
|
|
return $this->hasMany(Shift::class);
|
|
}
|
|
|
|
public function scopeForType(Builder $query, string $type): Builder
|
|
{
|
|
return $query->where('person_type', $type);
|
|
}
|
|
|
|
public function scopeForDate(Builder $query, Carbon $date): Builder
|
|
{
|
|
return $query->whereDate('date', $date);
|
|
}
|
|
}
|