From 74801fad1bc4f8c948885d25bcd91f30a4c5b31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 31 Aug 2022 12:06:30 +0200 Subject: [PATCH] Model Invoice : Add missing month on create --- app/Models/Invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index aab0f39..9f113d6 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -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'),