<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class School extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name', // Name of the school
'head_master', // Name of the head master
'head_master_photo', // URL or path to the head master's photo
'accompanying_teacher', // Name of the accompanying teacher/coach
'accompanying_teacher_photo', // URL or path to the accompanying teacher's photo
'address', // Address of the school
'phone_number', // Phone number of the school
'email', // Email of the school
'contingent_leader', // Name of the contingent leader
'contingent_leader_photo', // URL or path to the contingent leader's photo
'event_id', // Foreign key to the events table
];
/**
* Get the event associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function event(): BelongsTo
{
return $this->belongsTo(Event::class);
}
/**
* Get the users associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function users(): HasMany
{
return $this->hasMany(User::class);
}
/**
* Get the teams associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function teams(): HasMany
{
return $this->hasMany(Team::class, 'user_id');
}
}