OrderFreightModel.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Models;
  12. /**
  13. * 订单货物-模型
  14. * @author laravel开发员
  15. * @since 2020/11/11
  16. * @package App\Models
  17. */
  18. class OrderFreightModel extends BaseModel
  19. {
  20. // 设置数据表
  21. protected $table = 'orders_freights';
  22. /**
  23. * 货物类型
  24. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  25. */
  26. public function category()
  27. {
  28. return $this->hasOne(FreightCategoryModel::class, 'id','freight_cate_id')
  29. ->select(['id','name','pid','type','status']);
  30. }
  31. /**
  32. * 包装
  33. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  34. */
  35. public function package()
  36. {
  37. return $this->hasOne(FreightPackageModel::class, 'id','package_id')
  38. ->select(['id','name','status']);
  39. }
  40. /**
  41. * 规格
  42. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  43. */
  44. public function spec()
  45. {
  46. return $this->hasOne(FreightSpecModel::class, 'id','spec_id')
  47. ->select(['id','name','sub_name','status']);
  48. }
  49. }