public function marcarE()
 {
     $envio = Envios::find(Input::get('idEnvio'))->first();
     $envio->estatus = 'entregado';
     $envio->save();
     return Response::json('success');
 }
 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');
     }
 }
Exemple #3
0
 public function informes()
 {
     $enviosHD = Envios::informes()->get();
     $enviosT = Envios::informes2()->get();
     $enviosAll = Envios::informes3()->get();
     $total = Envios::totales()->get();
     $enviosHD2 = Envios::informesSemana()->get();
     $enviosT2 = Envios::informes2Semana()->get();
     $enviosAll2 = Envios::informes3Semana()->get();
     $total2 = Envios::totalesSemana()->get();
     $enviosHD3 = Envios::informesMes()->get();
     $enviosT3 = Envios::informes2Mes()->get();
     $enviosAll3 = Envios::informes3Mes()->get();
     $total3 = Envios::totalesMes()->get();
     return View::make('Admin.informe', compact('enviosHD', 'enviosT', 'enviosAll', 'total', 'enviosHD2', 'enviosT2', 'enviosAll2', 'total2', 'enviosHD3', 'enviosT3', 'enviosAll3', 'total3'));
 }
Exemple #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);
 }
 public function ultEnv()
 {
     $restaurante = Restaurantes::where('id', '=', Input::get('id_restaurante'))->get();
     $envios = Envios::ultimoenvio($restaurante->id)->take(1)->get();
     return json_encode($envios);
 }