register( slug: 'branding', routes: __DIR__.'/api-routes.php', capability: Capability::Branding->value, ); }); Event::listen(RenderingImage::class, [ThumbnailWatermarker::class, 'handle']); Event::listen(ResolvingImageRendering::class, [ThumbnailWatermarker::class, 'resolve']); // Gated like the screen that sets it. Without the capability there // is no branding page to reach, so a row that outlived a gate // change — a downgraded plan, a restored backup — would put // somebody's logo on every page of an installation offering no way // to see it, change it or take it off. Evaluated per request, so // uploading a logo or changing plan takes effect on the next one. Inertia::share('branding', function (): array { $setting = $this->available() ? BrandingSetting::query()->first() : null; return [ 'logo_url' => $setting?->logoUrl(), 'show_site_name' => $setting->show_site_name ?? false, ]; }); } private function available(): bool { return $this->app->make(CapabilityRegistry::class)->has(Capability::Branding); } }