sandboxService = $sandboxService; } public function addRoute(): void { if ($this->newType !== 'global') { $this->validate(['newTarget' => 'required|string|max:255']); } $target = $this->newType === 'global' ? null : trim($this->newTarget); $this->sandboxService->enable($this->newType, $target); $this->sandboxService->syncTransportFile(); $this->dispatch('sandbox-route-changed'); $this->newTarget = ''; } public function removeRoute(int $id): void { $this->sandboxService->delete($id); $this->sandboxService->syncTransportFile(); $this->dispatch('sandbox-route-changed'); } public function toggleRoute(int $id): void { $route = SandboxRoute::findOrFail($id); $route->is_active = !$route->is_active; $route->save(); $this->sandboxService->syncTransportFile(); $this->dispatch('sandbox-route-changed'); } public function syncPostfix(): void { $result = $this->sandboxService->syncTransportFile(); $this->syncOk = $result['ok']; $this->syncMessage = $result['message']; } #[Computed] public function routes() { return SandboxRoute::orderBy('type')->orderBy('target')->get(); } public function render() { return view('livewire.ui.system.sandbox-routes'); } }