ProcurementTotalBill.php 667 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App;
  3. use App\Traits\ModelTimeFormat;
  4. use Illuminate\Database\Eloquent\Model;
  5. use App\Traits\ModelLogChanging;
  6. class ProcurementTotalBill extends Model
  7. {
  8. use ModelLogChanging;
  9. use ModelTimeFormat;
  10. const status=[
  11. 0 => "未出账",
  12. 1 => "已出账",
  13. 2 => "已完结",
  14. ];
  15. protected $fillable=[
  16. 'counting_month','supplier_id','status','total_payable'
  17. ];
  18. public function supplier(){
  19. return $this->belongsTo('App\Supplier','supplier_id','id');
  20. }
  21. //截取账单日期为月
  22. public function getCountingMonthAttribute($value)
  23. {
  24. return substr($value,0,7);
  25. }
  26. }