<?php

namespace App\Model;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;

class WorkOrder extends Eloquent {
    //
    // use SoftDeletes;
    
	protected $connection = 'mongodb';
    protected $collection = 'work_order';
	
	protected $guarded = ['_id'];

	public function form() {
        return $this->belongsTo('App\Model\Form','_id','_id');
    }

    public function staff() {
        return $this->belongsTo('App\Model\Staff','_id','installer_id')->withTrashed();
    }

    public function company() {
        return $this->belongsTo('App\Model\Company','_id','contractor_id')->withTrashed();
    }

    public function docket() {
        return $this->hasOne('App\Model\Docket','work_order_id','wo')->withTrashed();
    }
}
