OwnerAreaReport.php 1.2 KB

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