OwnerStoragePriceModel.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\ModelLogChanging;
  5. class OwnerStoragePriceModel extends Model
  6. {
  7. use ModelLogChanging;
  8. protected $fillable = [
  9. "name", //名称
  10. "counting_type", //计费类型
  11. "using_type", //用仓类型
  12. "minimum_area", //最低起租面积
  13. "price", //单价
  14. "discount_type", //减免类型
  15. "discount_value", //减免值
  16. "unit_id", //单位ID
  17. "time_unit_id", //计时单位ID
  18. "operation", //操作
  19. "target_id", //目标ID
  20. "amount_interval", //数量区间
  21. "tax_rate_id", //税率
  22. ];
  23. protected $casts = [
  24. "amount_interval" => "array",
  25. "price" => "array"
  26. ];
  27. public function unit()
  28. { //单位
  29. return $this->belongsTo(Unit::class);
  30. }
  31. public function owners()
  32. { //货主
  33. return $this->belongsToMany(Owner::class,"owner_storage_price_model_owner","owner_storage_price_model_id","owner_id");
  34. }
  35. public function timeUnit()
  36. { //计时单位
  37. return $this->belongsTo(Unit::class,"time_unit_id");
  38. }
  39. public function taxRate()
  40. { //税率
  41. return $this->belongsTo(TaxRate::class);
  42. }
  43. }