<?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;
use Illuminate\Database\Eloquent\SoftDeletes;

class Logistic extends Model
{
    use ModelLogChanging;
    use SoftDeletes;
    use ModelTimeFormat;
    protected $fillable = ['name','code',"type","mobile","remark","delivery_fee","is_bunched","english_name"];


    static function nameById($id){
        $logistic=Logistic::where('id',$id)->first();
        return $logistic?$logistic['name']:'';
    }

    public function ownerPriceExpresses()
    {
        return $this->belongsToMany(OwnerPriceExpress::class,"owner_price_express_logistic","logistic_id","owner_price_express_id");
    }
}
