<?php
namespace App;
use Illuminate\Database\Eloquent\Model;

class Tapal extends Model
{
    protected $fillable = ['tapal_no','title','details','internal_external','tapal_description','initiated_tapal_id','received_from','received_date','mode_of_receipt','priority','confidential','has_valuables','subject_group_id','subject_id','keywords','status','created_by','updated_by','office_id','closed_by','closed_date'];
    protected $table='tapal';

    function subject()
    {
    	return $this->belongsTo('\App\Subject','subject_id');
    }
    function user()
    {
    	return $this->belongsTo('\App\User','created_by');
    }
    function closedby()
    {
        return $this->belongsTo('\App\User','closed_by');
    }

    function subject_groupobj()
    {
    	return $this->belongsTo('\App\Subject_Group','subject_group_id');
    }

    function documents()
    {
    	return $this->hasMany('\App\Documents','tapal_id');
    }

    function seat_permission()
    {
        return $this->hasMany('\App\Seat_Permission','seat_id');
    }

     function user_seat()
    {
        return $this->belongsTo('\App\User_Seat','seat_id');
    }

    function priorityobj()
    {
    	return $this->belongsTo('\App\Priority','priority');
    }

    function office()
    {
        return $this->belongsTo('\App\Office','office_id');
    }

}
