36 lines
762 B
PHP
36 lines
762 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 Entry extends Model
|
|
{
|
|
use HasFactory;
|
|
protected $guarded = [];
|
|
|
|
public function student(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Student::class);
|
|
}
|
|
|
|
public function audition(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Audition::class);
|
|
}
|
|
|
|
public function school(): HasOneThrough
|
|
{
|
|
return $this->hasOneThrough(
|
|
School::class,
|
|
Student::class,
|
|
'id',
|
|
'id',
|
|
'student_id',
|
|
'school_id');
|
|
}
|
|
}
|