validated('ip')); // Delete through the action so extension wrappers see each allocation, while // the transaction keeps the block delete all-or-nothing like the bulk query was. DB::transaction(function () use ($deleter, $node, $ip): void { $node->allocations()->unassigned()->where('ip', $ip)->lockForUpdate()->get() ->each(fn (Allocation $allocation) => $deleter->delete($allocation)); }); Activity::event('admin:node-allocation.delete-block') ->subject($node) ->property('address', $ip) ->log(); return $this->returnNoContent(); } }