OwnerFeeDetail.php 2.7 KB

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