OwnerAreaReport.php 950 B

123456789101112131415161718192021222324252627282930313233343536
  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. "user_owner_group_id", //项目组ID
  10. "area_on_tray", //货物整托
  11. "area_on_half_tray", //货物半托
  12. "area_on_flat", //平面区面积
  13. "accounting_area", //结算面积
  14. "status" //状态
  15. ];
  16. public function owner()
  17. { //货主
  18. return $this->hasOne(Owner::class,"id","owner_id");
  19. }
  20. public function userOwnerGroup()
  21. { //项目组
  22. return $this->hasOne(UserOwnerGroup::class,"id","user_owner_group_id");
  23. }
  24. /* 结算月格式转换,仅截取至月
  25. * 引用:CreateOwnerReport
  26. */
  27. public function getCountingMonthAttribute($value)
  28. {
  29. return substr($value,0,7);
  30. }
  31. }