enabled();} catch(ValidationException $e) { // An enabled but corrupt policy must not silently lose paid consumption. // Hooks below reject new creation/opening until an administrator repairs it. Log::warning('vip_loyalty_invalid_configuration');$enabled=true; } if(!$enabled){$service->suspend();return;} $this->listen('order.create.before',static function($payload)use($service){$service->sync($payload[0]->id);}); $this->listen('order.open.before',[$service,'openingOrder']); $this->listen('admin.user.update.after',[$service,'manualChanged']); } public function cleanup(): void { if(Schema::hasTable('fuc_vip_accounts'))app(Service::class)->suspend(); } }