billing: Nebenläufigkeit & Idempotenz härten (H4, Stripe, Boost-Slots)
- CreditTopup-Gutschrift, MAN-Rechnung, Proof-PDF und Stripe-Webhook- Spiegelung sperren die betroffene Zeile innerhalb der Transaktion und prüfen die Idempotenz erst danach (verhindert Doppelgutschrift bei at-least-once-Webhooks, H4). - Gemeinsamer LocksModelForUpdate-Trait für die häufige Lock-by-Key-Form (CreditTopup, ManualInvoice). - Unique-Index auf invoices.stripe_invoice_id; Boost-Inventar über boost_slot_locks serialisiert, verwaiste Kategorie-Locks werden beim Löschen der Rubrik entfernt. Deployment: vor migrate prüfen, ob invoices.stripe_invoice_id bereits Duplikate enthält (die Unique-Migration bricht sonst bewusst ab). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
3295f47556
commit
aae456954a
14 changed files with 418 additions and 106 deletions
|
|
@ -64,6 +64,8 @@ new #[Layout('components.layouts.app'), Title('Kategorie bearbeiten')] class ext
|
|||
|
||||
public function save(): void
|
||||
{
|
||||
$this->authorize('categories:manage');
|
||||
|
||||
$this->validate([
|
||||
'parentId' => ['nullable', 'integer', Rule::notIn([$this->id]), 'exists:categories,id'],
|
||||
'descriptionDe' => ['nullable', 'string', 'max:1000'],
|
||||
|
|
@ -117,6 +119,8 @@ new #[Layout('components.layouts.app'), Title('Kategorie bearbeiten')] class ext
|
|||
|
||||
public function deleteCategory(): void
|
||||
{
|
||||
$this->authorize('categories:manage');
|
||||
|
||||
$category = Category::query()->findOrFail($this->id);
|
||||
|
||||
if ($category->pressReleases()->withoutGlobalScopes()->exists()) {
|
||||
|
|
@ -133,6 +137,9 @@ new #[Layout('components.layouts.app'), Title('Kategorie bearbeiten')] class ext
|
|||
|
||||
$category->delete();
|
||||
|
||||
// Verwaiste Boost-Slot-Locks der gelöschten Rubrik aufräumen.
|
||||
app(\App\Services\PressRelease\BoostService::class)->forgetSlotLocksForCategory((int) $category->id);
|
||||
|
||||
session()->flash('success', __('Kategorie wurde gelöscht.'));
|
||||
$this->redirect(route('admin.categories.index'), navigate: true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue