id); View::share("vpn", $vpn); //Get Selectet VPN $currentVPNId = session()->get("current_vpn"); if($currentVPNId === null && count($vpn)==1) { session()->put("current_vpn", $vpn[0]->id); $currentVPNId = $vpn[0]->id; } $currentVPN = VPN::query()->where("id", "=", $currentVPNId)->first(); if($currentVPN != null) { View::share("currentVPNName", $currentVPN->name); } return $next($request); } }