public function editarHD() { if (Input::has('Editar')) { $usershd = UsuariosHD::find(Input::get('userhd_id')); $restaurante = Restaurantes::All(); $restaurantes = Restaurantes::where('id', '>', 0)->get(); return View::make('Admin.EditarUHD', compact('usershd', 'restaurante', 'restaurantes')); } if (Input::has('Eliminar')) { $usershd = UsuariosHD::where('id', '=', Input::get('userhd_id'))->get(); $usershd[0]->delete(); return Redirect::to('admin/usershd')->with('message', 'Empleado eliminado con éxito'); } }
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'); } }
public function ultEnv() { $restaurante = Restaurantes::where('id', '=', Input::get('id_restaurante'))->get(); $envios = Envios::ultimoenvio($restaurante->id)->take(1)->get(); return json_encode($envios); }
public function editar() { if (Input::has('Editar')) { $publicidad = Publicidad::find(Input::get('publicidad_id')); $restaurante = Restaurantes::where('id', '=', $publicidad->id_restaurante); return View::make('Admin.publicidad2', compact('publicidad', 'restaurante')); } if (Input::has('Eliminar')) { $publicidad = Publicidad::where('id', '=', Input::get('publicidad_id'))->get(); $publicidad[0]->delete(); return Redirect::to('admin/publicidad')->with('message', 'Publicidad eliminada con éxito'); } }