43 lines
871 B
PHP
43 lines
871 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
|
|
|
|
class Seat extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $guarded = [];
|
|
|
|
public function ensemble(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Ensemble::class);
|
|
}
|
|
|
|
public function audition(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Audition::class);
|
|
}
|
|
|
|
public function entry(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Entry::class);
|
|
}
|
|
|
|
public function student(): HasOneThrough
|
|
{
|
|
return $this->hasOneThrough(
|
|
Student::class,
|
|
Entry::class,
|
|
'id',
|
|
'id',
|
|
'entry_id',
|
|
'student_id'
|
|
);
|
|
}
|
|
}
|