You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thank you for your great package. I have 1 doubt, how can I stop auto generation during creation, because I want to generate later
Let us say I am creating a Voucher, when creating I don't want a voucher_no, its null. Later when the user confirms the voucher creation teh voucher status becomes conformed while the voucher_no is also created at that time.
You can defer generation with the current version — just create the voucher quietly so auto-generation doesn't fire, then generate on confirm:
// On create — voucher_no stays null$voucher = newVoucher($data);
$voucher->saveQuietly();
// On confirm$voucher->voucher_no = $voucher->generateReference();
$voucher->save();
Just make the column nullable: $table->string('voucher_no')->nullable()->unique()->index();
This is a bit of an edge case, so I don't think it needs a dedicated feature in the package — saveQuietly() covers it well. Only thing to keep in mind is that it skips other model events on that insert too.
Activity
EG-Mohamed commentedon Jun 12, 2026
Hi, thanks for the kind words!
You can defer generation with the current version — just create the voucher quietly so auto-generation doesn't fire, then generate on confirm:
Just make the column nullable:
$table->string('voucher_no')->nullable()->unique()->index();This is a bit of an edge case, so I don't think it needs a dedicated feature in the package —
saveQuietly()covers it well. Only thing to keep in mind is that it skips other model events on that insert too.Hope that helps!