OwnerStoragePriceModel.php 980 B

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