OwnerStoragePriceModel.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. ];
  22. protected $casts = [
  23. "amount_interval" => "array",
  24. "price" => "array"
  25. ];
  26. public function unit()
  27. { //单位
  28. return $this->belongsTo(Unit::class);
  29. }
  30. public function owners()
  31. { //货主
  32. return $this->belongsToMany(Owner::class,"owner_storage_price_model_owner","owner_storage_price_model_id","owner_id");
  33. }
  34. public function timeUnit()
  35. { //计时单位
  36. return $this->belongsTo(Unit::class,"time_unit_id");
  37. }
  38. }