url())) { return $next($request); } if ($this->initialized() && request()->routeIs(['initialize.form'])) { return redirect()->to(RouteServiceProvider::HOME); } if (!$this->shouldRedirect()) { return $next($request); } if (!$this->initialized()) { return redirect()->route('initialize.form'); } return $next($request); } public function shouldRedirect(): bool { return !request()->routeIs($this->dontRedirect) && auth()->check(); } public function initialized(): bool { return 0 !== app(NamiSettings::class)->default_group_id; } }