OwnerBillReport.php 668 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class OwnerBillReport extends Model
  5. {
  6. protected $fillable = [
  7. "owner_id", //项目ID
  8. "counting_month", //结算月
  9. "initial_fee", //原始账单金额
  10. "confirm_fee", //确认账单金额
  11. "difference", //差额
  12. "confirmed", //确认状态
  13. ];
  14. public function owner()
  15. { //货主
  16. $this->hasOne(Owner::class,"id","owner_id");
  17. }
  18. /* 结算月格式转换,仅截取至月
  19. * 引用:CreateOwnerReport
  20. */
  21. public function getCountingMonthAttribute($value)
  22. {
  23. return substr($value,0,7);
  24. }
  25. }