route()?->getName() ?? ''; return str_starts_with($name, 'user.') ? 'user' : 'admin'; } protected function isAgentPortal(): bool { return $this->portal() === 'user'; } protected function agent(): ?User { if (! $this->isAgentPortal()) { return null; } /** @var User|null $user */ $user = auth('agent')->user(); return $user; } protected function routeName(string $suffix): string { return $this->portal().'.'.$suffix; } }