OwnerAreaReport.php 733 B

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