public function postRegister(Request $request) { $userAdmin = new userAdmin(); $entidad = new entidadTuristica(); $servicios = new servicios(); $estado = new estados(); $estados = $estado->getEstados(); $respuesta = ['loginSelected' => "", 'regSelected' => "toggled", 'recoverSelected' => "", 'regSuccess' => "", 'estados' => $estados]; //Validando antes de ingresar un usuario administrativo if ($userAdmin->exists($request->email)) { return view("login2")->with($respuesta)->withErrors(["errorEmail" => "Ya existe un usuario con ese email"]); } else { if ($entidad->exists($request->rif)) { return view("login2")->with($respuesta)->withErrors(["errorEntidad" => "Ya existe una entidad registrada con ese rif"]); } else { $requestEntidad = ["rif" => strtoupper($request->rif), "nombre" => $request->nombre, "telefono1" => $request->telefono1, "telefono2" => NULL, "tipoentidad" => $request->tipo, "tipohotel" => $request->tipohotel, "idestado" => $request->estado, "idciudad" => $request->ciudad, "descripcion" => $request->descripcion]; $requestUser = ["email" => $request->email, "password" => $request->password, "identidad" => $request->rif, "tipo" => "entidad"]; $respuesta['regSuccess'] = "true"; $respuesta['loginSelected'] = "toggled"; $respuesta['regSelected'] = ""; $entidad->createNew($requestEntidad); $userAdmin->createNew($requestUser); if ($request->tipo == "Hotel") { $servicios->createNew(strtoupper($request->rif)); } return view("login2")->with($respuesta); } } }