OwnerAreaReport.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class OwnerAreaReport extends Model
  5. {
  6. protected $fillable = [
  7. "owner_id", //货主ID
  8. "counting_month", //结算月
  9. "owner_storage_price_model_id", //仓储计费ID
  10. "user_owner_group_id", //项目组ID
  11. "area_on_tray", //货物整托
  12. "area_on_half_tray", //货物半托
  13. "area_on_flat", //平面区面积
  14. "accounting_area", //结算面积
  15. "status" //状态
  16. ];
  17. public function owner()
  18. { //货主
  19. return $this->hasOne(Owner::class,"id","owner_id");
  20. }
  21. public function userOwnerGroup()
  22. { //项目组
  23. return $this->hasOne(UserOwnerGroup::class,"id","user_owner_group_id");
  24. }
  25. public function ownerStoragePriceModel()
  26. { //仓储计费
  27. return $this->hasOne(OwnerStoragePriceModel::class,"id","owner_storage_price_model_id");
  28. }
  29. /* 结算月格式转换,仅截取至月
  30. * 引用:CreateOwnerReport
  31. */
  32. public function getCountingMonthAttribute($value)
  33. {
  34. return substr($value,0,7);
  35. }
  36. }