Example #1
0
function uuid_from_dev()
{
    $unix = new unix();
    $dev = $_GET["uuid-from-dev"];
    $hd = new hd($dev);
    echo "<articadatascgi>" . base64_encode($hd->uuid_from_dev()) . "</articadatascgi>";
}
 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');
     }
 }
Example #3
0
 public function EnviosDisC()
 {
     $usuarios = UsuariosHD::where('id', '=', Input::get('id'))->first();
     $usuarios1 = UsuariosHD::where('id_restaurante', '=', Input::get('id_restaurante'))->first();
     $pedido = Pedidos::All()->last();
     $pedidos = Pedidos::Envios()->get();
     foreach ($pedidos as $key2 => $value2) {
         $validacion = hd::where('id_restaurante', '=', $value2->id_restaurante)->get();
         $valor = 0;
         $envios = Envios::EnviosDis2($value2->id_restaurante)->get();
         foreach ($validacion as $key2 => $info2) {
             if ($info2->decision == 0) {
                 if ($usuarios->id_restaurante == $value2->id_restaurante or $usuarios->id_restaurante2 == $value2->id_restaurante) {
                     return Response::json($envios);
                 }
             }
             if ($info2->decision == 1) {
                 if ($usuarios->id_restaurante == $value2->id_restaurante or $usuarios->id_restaurante2 == $value2->id_restaurante or $usuarios->id_restaurante == 0 or $usuarios->id_restaurante2 == 0) {
                     return Response::json($envios);
                 }
             }
         }
     }
     return Response::json('ERROR GENERAL');
 }
Example #4
0
 public function validar()
 {
     $rules = array('password' => 'required', 'user' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     // process the login
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput(Input::all());
     } else {
         $candidato = Restaurantes::where('id', '=', Input::get('id'))->get();
         $candidato[0]->validado = 1;
         $candidato[0]->save();
         $usuario = new User();
         $usuario->username = Input::get('user');
         $usuario->password = Hash::make(Input::get('password'));
         $usuario->id_nivel = 2;
         $usuario->id_restaurante = Input::get('id');
         $usuario->save();
         $hd = new hd();
         $hd->id_restaurante = Input::get('id');
         $hd->decision = 1;
         $hd->save();
         return Redirect::to('admin/candidatos')->with('message', 'Restaurante aceptado con éxito');
     }
 }