OwnerFeeDetail.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace App;
  3. use App\Services\ProcessMethodService;
  4. use Illuminate\Database\Eloquent\Model;
  5. use App\Traits\ModelLogChanging;
  6. use Illuminate\Database\Eloquent\Relations\HasMany;
  7. use Illuminate\Database\Eloquent\Relations\HasOne;
  8. class OwnerFeeDetail extends Model
  9. {
  10. // use ModelLogChanging;
  11. protected $fillable = [
  12. "owner_id", //货主ID
  13. "worked_at", //作业时间
  14. "type", //类型
  15. "shop_id", //店铺ID
  16. "operation_bill", //发/收/退/提货单号
  17. "consignee_name", //收件人
  18. "consignee_phone", //收件人电话
  19. "commodity_amount", //商品数量
  20. "logistic_bill", //快递单号
  21. "volume", //体积
  22. "weight", //重量
  23. "logistic_id", //物流ID
  24. "process_method_id",//加工类型ID
  25. "work_fee", //作业费
  26. "logistic_fee", //物流费
  27. "created_at", //创建时间
  28. "outer_id", //关联表ID
  29. "outer_table_name", //关联表名
  30. "work_tax_fee", //作业税费
  31. "logistic_tax_fee", //物流税费
  32. "province", //省份
  33. "owner_price_operation_id" //引用的作业模型
  34. ];
  35. public $timestamps = false;
  36. public function owner()
  37. { //货主
  38. return $this->hasOne(Owner::class,"id","owner_id");
  39. }
  40. public function shop()
  41. { //店铺
  42. return $this->hasOne(Shop::class,"id","shop_id");
  43. }
  44. public function logistic()
  45. { //物流
  46. return $this->hasOne(Logistic::class,"id","logistic_id");
  47. }
  48. public function processMethod()
  49. { //作业类型
  50. return $this->hasOne(ProcessMethod::class,"id","process_method_id");
  51. }
  52. public function order()
  53. { //出库单
  54. return $this->belongsTo(Order::class,"outer_id","id");
  55. }
  56. public function store()
  57. { //入库单
  58. return $this->belongsTo(Store::class,"outer_id","id");
  59. }
  60. public function items()
  61. { //快递费子项
  62. return $this->hasMany(OwnerFeeDetailLogistic::class,"owner_fee_detail_id","id");
  63. }
  64. public function ownerLogisticFeeDetails(): HasMany
  65. {
  66. return $this->hasMany(OwnerLogisticFeeDetail::class);
  67. }
  68. public function ownerLogisticFeeDetail(): HasOne
  69. {
  70. return $this->hasOne(OwnerLogisticFeeDetail::class,'logistic_bill','logistic_bill');
  71. }
  72. }