37 lines
868 B
PHP
37 lines
868 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
/**
|
|
* @property date $start_date
|
|
* @property date $end_date
|
|
* @property Pilgrim[] $pilgrims
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
*/
|
|
class Group extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public function pilgrims(): HasMany
|
|
{
|
|
return $this->hasMany(Pilgrim::class);
|
|
}
|
|
|
|
public function leaderTeacher(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Teacher::class, 'leader_teacher_id');
|
|
}
|
|
|
|
public function helperTeachers(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Teacher::class, 'group_teacher');
|
|
}
|
|
}
|