<?php

namespace App\Models\Training;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Schedule extends Model
{
	use SoftDeletes;
    protected $table='schedule';
    protected $primaryKey = 'id';
    protected $fillable = ['organisation_id','department_id','section_id','material_type_id','training_title','venue','period_from','period_to','invitation_required_status','registration_status','min_seat_training','max_seat_training','question_answer_status','review_status','training_certificates','training_fees','training_allowance','remarks','certificate_template','created_by','updated_by'];
    
    function organisation()
    {
        return $this->belongsTo('\App\Models\Settings\Organisation','organisation_id','id');
    }
    function material_type()
    {
        return $this->belongsTo('\App\Models\Settings\MaterialType','material_type_id','id');
    }
    function department()
    {
        return $this->belongsTo('\App\Models\Settings\Department','department_id','id');
    }
    function section()
    {
        return $this->belongsTo('\App\Models\Settings\Section','section_id','id');
    }

    function schedule_role()
    {
        return $this->hasMany('\App\Models\Training\ScheduleRoles','schedule_id','id');
    }
    function schedule_participants()
    {
        return $this->hasMany('\App\Models\Training\Participant','schedule_id','id');
    }
    function schedule_topics()
    {
        return $this->hasMany('\App\Models\Training\ScheduleTopics','schedule_id','id');
    }
}
