<?php

namespace App\Models\Facility;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
use OwenIt\Auditing\Auditable as AuditableTrait;

class Facility extends Model implements Auditable
{
	use SoftDeletes;
    use AuditableTrait;
    protected $table='facility';
    protected $primaryKey = 'id';
    protected $fillable = ['organisation_id','facility_name','timedshowflag','noofseats','fixedseatflag','maxticketperperson','active_flag','short_code','order_by'];
    
    function organisation()
    {
        return $this->belongsTo('\App\Models\Settings\Organisation','organisation_id','id');
    }

    function showtimings()
    {
        return $this->hasMany('\App\Models\Facility\ShowTimings','facility_id','id')->where('active_flag', 1);
    }
    function layout()
    {
        return $this->hasOne('\App\Models\Facility\Layout','facility_id','id');
    }
    function rates()
    {
        return $this->hasMany('\App\Models\Facility\Rates','facility_id','id')->where('active_flag', 1);
    }

}
