OwnerStoragePriceModel.php 826 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\LogModelChanging;
  5. class OwnerStoragePriceModel extends Model
  6. {
  7. use LogModelChanging;
  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. ];
  18. public function unit()
  19. { //单位
  20. return $this->hasOne(Unit::class,"id","unit_id");
  21. }
  22. public function owners()
  23. { //货主
  24. return $this->belongsToMany(Owner::class,"owner_storage_price_model_owner","owner_storage_price_model_id","owner_id");
  25. }
  26. }