Logistic.php 686 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Builder;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * @method static Builder orderBy(string $string, string $string1)
  7. */use App\Traits\ModelTimeFormat;
  8. class Logistic extends Model
  9. {
  10. use ModelTimeFormat;
  11. protected $fillable = ['name','code',"type","mobile","remark","delivery_fee"];
  12. static function nameById($id){
  13. $logistic=Logistic::where('id',$id)->first();
  14. return $logistic?$logistic['name']:'';
  15. }
  16. public function ownerPriceExpresses()
  17. {
  18. return $this->belongsToMany(OwnerPriceExpress::class,"owner_price_express_logistic","logistic_id","owner_price_express_id");
  19. }
  20. }