Logistic.php 747 B

12345678910111213141516171819202122232425262728293031
  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. use App\Traits\ModelLogChanging;
  9. class Logistic extends Model
  10. {
  11. use ModelLogChanging;
  12. use ModelTimeFormat;
  13. protected $fillable = ['name','code',"type","mobile","remark","delivery_fee"];
  14. static function nameById($id){
  15. $logistic=Logistic::where('id',$id)->first();
  16. return $logistic?$logistic['name']:'';
  17. }
  18. public function ownerPriceExpresses()
  19. {
  20. return $this->belongsToMany(OwnerPriceExpress::class,"owner_price_express_logistic","logistic_id","owner_price_express_id");
  21. }
  22. }