public function inicio() { //id del usuario logueado $id_logueado = Auth::user()->id; if (Auth::user()->nivel === 'cliente') { $servicio = Servicio::where('cliente_id', $id_logueado)->orderBy('updated_at', 'DESC')->take(5)->get(); $cantidad = count($servicio); return view('inicioCliente')->with('servicio', $servicio)->with('cantidad', $cantidad); } else { if (Auth::user()->nivel === 'tecnico') { $servicio = Servicio::where('tecnico_id', $id_logueado)->get(); $cantidad = count($servicio); return view('inicioTecnico')->with('servicio', $servicio)->with('cantidad', $cantidad); } else { if (Auth::user()->nivel === 'administrador') { $tecnicos = User::where('nivel', 'tecnico')->count(); $clientes = User::where('nivel', 'cliente')->count(); $registrados = Servicio::count(); $concluidos = Servicio::where('status', 3)->count(); return view('inicioAdmin')->with('tecnicos', $tecnicos)->with('clientes', $clientes)->with('registrados', $registrados)->with('concluidos', $concluidos); } } } }