<?php
 namespace App\Observers; use App\Models\RouteSlug; class RouteSlugObserver { public function saved(RouteSlug $slug): void { $this->invalidate(); } public function deleted(RouteSlug $slug): void { $this->invalidate(); } protected function invalidate(): void { RouteSlug::flushCache(); try { \Illuminate\Support\Facades\Artisan::call('route:clear'); } catch (\Throwable $e) { } } } 