<?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;

class Logistic extends Model
{
    use ModelTimeFormat;
    protected $fillable = ['name','code'];


    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");
    }
}
