Model Invoice : Add missing month on create
This commit is contained in:
parent
3045a809b3
commit
74801fad1b
1 changed files with 1 additions and 1 deletions
|
|
@ -251,7 +251,7 @@ class Invoice extends Model
|
|||
static::creating(function (self $model) {
|
||||
$model->ref = \sprintf(
|
||||
'%s_%s_%s',
|
||||
Carbon::now()->isoFormat('YYYY'),
|
||||
Carbon::now()->isoFormat('YYYY-MM'),
|
||||
Str::padLeft((Invoice::whereYear('created_at', Carbon::now()->isoFormat('YYYY'))
|
||||
->whereMonth('created_at', Carbon::now()->isoFormat('MM'))
|
||||
->count() + 1) ?: 1, 4, '0'),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue