OwnerStoragePriceModel.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. ];
  21. public function unit()
  22. { //单位
  23. return $this->belongsTo(Unit::class);
  24. }
  25. public function owners()
  26. { //货主
  27. return $this->belongsToMany(Owner::class,"owner_storage_price_model_owner","owner_storage_price_model_id","owner_id");
  28. }
  29. public function timeUnit()
  30. { //计时单位
  31. return $this->belongsTo(Unit::class,"time_unit_id");
  32. }
  33. }