<?php

namespace App;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

/**
 * @method static Builder orderBy(string $string, string $string1)
 */use App\Traits\ModelTimeFormat;

use App\Traits\ModelLogChanging;

class Rejected extends Model
{
    use ModelLogChanging;

    use ModelTimeFormat;
    protected $fillable=['id_owner','order_number','sender','mobile_sender',
        'logistic_number','logistic_number_return','id_logistic_return',
        'validity_at','batch_number','id_quality_label','amount','name_goods',
        'barcode_goods','is_loaded','fee_collected','id_logistic_return','remark','is_checked','created_at','goodses'];
    function owner(){
        return $this->hasOne('App\Owner','id','id_owner');
    }
    function logistic(){
        return $this->hasOne('App\Logistic','id','id_logistic_return');
    }
    function logisticName(){
         $logistic=$this->hasOne('App\Logistic','id','id_logistic_return')->first();
         return $logistic?$logistic['name']:'';
    }
    function qualityLabel(){
        return $this->hasOne('App\QualityLabel','id','id_quality_label');
    }
    function qualityLabelName(){
        $qualityLabel=$this->hasOne('App\QualityLabel','id','id_quality_label')->first();
        return $qualityLabel?$qualityLabel['name']:'';
    }
}
