<?php

namespace Portal\Mileage\Model;

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

class MainApp extends Model
{
    /**
     * The database table used by the model.
     *
     * @var string
     */
    use SoftDeletes;
    protected $table = 'main_app';


    public function leavetype()
    {
        return $this->hasOne('Portal\Mileage\Model\ApplType','id','appl_type_id');
    }

    public function user()
    {
    	return $this->hasOne('Portal\Mileage\Model\Users','id','user_id');
    }

    public function lkpstatus()
    {
    	return $this->hasOne('Portal\Mileage\Model\LkpStatus','id','status');
    }

    public function appleave()
    {
    	return $this->hasOne('Portal\Mileage\Model\ApplLeave','main_app_id','id');
    }

    public function verifier()
    {
        return $this->hasOne('Portal\Mileage\Model\Users','id','supported_by');
    }

    public function approver()
    {
        return $this->hasOne('Portal\Mileage\Model\Users','id','approved_by');
    }

    public function cancelleave()
    {
    	return $this->hasOne('Portal\Mileage\Model\CancelLeave','main_app_id');
    }

    public function gcr()
    {
        return $this->hasOne('Portal\Mileage\Model\Gcr','main_app');
    }

    public function attachment()
    {
        return $this->hasOne('Portal\Mileage\Model\Attachment','main_app_id');
    }



    // public function details()
    // {
    //     return $this->hasMany('Elesen\Model\Data\Model\License\LicenseDetail','fk_license');
    // }



}
