<?php

namespace App;

use App\Traits\ModelTimeFormat;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

use App\Traits\ModelLogChanging;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;

class ProcurementDeliverie extends Model
{
    use ModelLogChanging;
    use ModelTimeFormat;

    protected $fillable=[
        'procurement_id','amount', 'initiator','status','signer','signed_at','receipt_amount','created_at','updated_at'
    ];
    const status=[
        0=>'待送货',
        1=>'送货中',
        2=>'送货完成',
    ];
    public function procurement(){
        return $this->belongsTo('App\Procurement','procurement_id','id');
    }

    public function receiver(){
        return $this->belongsTo('App\User','signer','id');
    }
    public function procurementCheckSheet(){
        return $this->belongsTo('App\ProcurementCheckSheet','id','procurement_delivery_id');
    }
}
