Ejemplo n.º 1
0
 public function registrar()
 {
     $username = Input::get('correo');
     $usuarios = User::where('username', '=', $username)->count();
     $codigo = Input::get('codigo_postal');
     if ($codigo > 34398 || $codigo < 34000) {
         return Response::json('0');
     } elseif ($usuarios > 0) {
         return Response::json('usuario repetido');
     } else {
         $reg_id = Input::get('reg_id');
         $user = new UsuariosHD();
         $user->username = $username;
         $user->id_restaurante = 0;
         $user->estatus = 0;
         $user->estatus_u = 'disponible';
         $user->password = Hash::make(Input::get('password'));
         $user->nombre = Input::get('nombre');
         $user->apellidos = Input::get('apellidos');
         $user->correo = $username;
         $user->edad = Input::get('edad');
         $user->sexo = Input::get('sexo');
         $user->reg_id = $reg_id;
         $user->codigo_postal = Input::get('codigo_postal');
         $user->save();
         return Response::json('1');
     }
 }
Ejemplo n.º 2
0
 public function hogarPedidos()
 {
     $pedido = Pedidos::find(Input::get('idpedido'));
     $user = $usuario = User::where('id', '=', $pedido->id_usuario)->first();
     $restaurante = Restaurantes::where('id', '=', $pedido->id_restaurante);
     $var = Auth::user()->id_restaurante;
     $validacion = hd::where('id_restaurante', '=', $var)->get();
     if (Input::has('Confirmar')) {
         $pedido->estatus = 'sinPagar';
         $pedido->save();
         $envios = new Envios();
         $envios->estatus = 'pendiente';
         $envios->id_pedido = $pedido->id;
         $envios->coordenadas_accidente = 0;
         $envios->id_restaurante = $pedido->id_restaurante;
         $envios->save();
         foreach ($validacion as $key2 => $info2) {
             if ($info2->decision == 0) {
                 $reg = UsuariosHD::reg($var)->get();
                 if ($reg != "") {
                     foreach ($reg as $key => $info) {
                         $valor = PushNotification::Message('¡Envíos disponibles!', array('valor' => 1, 'sound' => 'example.aiff', 'actionLocKey' => 'Action button title!', 'locKey' => 'localized key', 'locArgs' => array('localized args', 'localized args'), 'launchImage' => 'image.jpg', 'custom' => array('custom data' => array('we' => 'want', 'send to app'))));
                         PushNotification::app('HappyDelivery')->to($info->reg_id)->send($valor);
                     }
                 }
             }
             if ($info2->decision == 1) {
                 $reg = UsuariosHD::reg2($var)->get();
                 if ($reg != "") {
                     foreach ($reg as $key => $info) {
                         $valor = PushNotification::Message('¡Envíos disponibles!', array('valor' => 1, 'sound' => 'example.aiff', 'actionLocKey' => 'Action button title!', 'locKey' => 'localized key', 'locArgs' => array('localized args', 'localized args'), 'launchImage' => 'image.jpg', 'custom' => array('custom data' => array('we' => 'want', 'send to app'))));
                         PushNotification::app('HappyDelivery')->to($info->reg_id)->send($valor);
                     }
                 }
             }
         }
         return Redirect::to('/')->with('success', 'Orden Aceptada Con Exito');
     } elseif (Input::has('Declinar')) {
         $pedido->estatus = 'declinada';
         $pedido->save();
         return Redirect::to('/')->with('success', 'Orden Cancelada Con Exito');
     }
 }
Ejemplo n.º 3
0
 public function borrar_candidato()
 {
     $candidato = UsuariosHD::where('id', '=', Input::get('id'))->get();
     $candidato[0]->delete();
     $candidatos = UsuariosHD::where('estatus', '=', 0)->get();
     return View::make('Admin.candidatos', compact('candidatos'));
 }
Ejemplo n.º 4
0
 public function envioConfirmado()
 {
     $usuario = UsuariosHD::where('id', '=', Input::get('id'))->first();
     $envios = Envios::EnviosConfirmados($usuario->id)->take(1)->get();
     return Response::json($envios);
 }
Ejemplo n.º 5
0
 public function envres()
 {
     $usuario = User::where('username', '=', Input::get('username'))->first();
     $estado = UsuariosHD::where('id', '=', Input::get('id_usuarioHD'))->first();
     $id_envio = Input::get('id');
     $confirmacion = Input::get('confirmacion');
     $pedido = Pedidos::where('id', '=', $id_envio->id_restaurante);
     $reg = Input::get('reg_id');
     if ($confirmacion == 'si') {
         $envios = Envios::find(Input::get('id'));
         $envios->estatus = 'recibido';
         $envios->save();
         $estado->estatus_u = 'disponible';
         $estado->save();
         $pedido->estatus = 'valorar';
         $pedido->save();
         return Response::json('success si');
     } elseif ($confirmacion == 'no') {
         $envios = Envios::find(Input::get('id'));
         $envios->estatus = 'confirmado';
         $envios->save();
         $estado->estatus_u = 'noatendida';
         $estado->save();
         return Response::json('success no');
     } else {
         return Response::json('error');
     }
 }