public function getCompra()
 {
     $id = Input::get('id');
     $pub_id = Input::get('pub_id');
     $aux = Compras::where('pub_id', '=', $pub_id)->where('user_id', '=', $pub_id)->where(function ($query) {
         $query->where('valor_vend', '=', 0)->orWhere('fechVal', '=', date('Y-m-d', time() + 172800));
     })->first();
     if (!empty($aux)) {
         return Response::json(array('type' => 'danger', 'msg' => 'Usted ya ha contactado este usuario y aun no se ha valorado'));
     }
     $comp = new Compras();
     $comp->pub_id = $pub_id;
     $comp->user_id = $id;
     $comp->valor_comp = 0;
     $comp->valor_vend = 0;
     $comp->fechVal = date('Y-m-d', time() + 172800);
     if ($comp->save()) {
         $pub = Publicaciones::find($pub_id);
         $user = User::find($pub->user_id);
         $msg = "Han respondido tu comentario: " . $pub->titulo;
         $data = array('message' => $msg, 'title' => $msg, 'msgcnt' => null, 'timeToLive' => 3000);
         return Response::json(array('type' => 'success', 'msg' => 'Se ha generado una compra', 'compra_id' => $comp->id));
     }
 }
 public function postElimImage()
 {
     $id = Input::get('id');
     $pub = Publicaciones::find($id);
     $img = Input::get('img');
     switch ($img) {
         case 'img2':
             File::delete('images/pubImages/' . $pub->img_2);
             $pub->img_2 = '';
             break;
         case 'img3':
             File::delete('images/pubImages/' . $pub->img_3);
             $pub->img_3 = '';
             break;
         case 'img4':
             File::delete('images/pubImages/' . $pub->img_4);
             $pub->img_4 = '';
             break;
         case 'img5':
             File::delete('images/pubImages/' . $pub->img_5);
             $pub->img_5 = '';
             break;
         case 'img6':
             File::delete('images/pubImages/' . $pub->img_6);
             $pub->img_6 = '';
             break;
         case 'img7':
             File::delete('images/pubImages/' . $pub->img_7);
             $pub->img_7 = '';
             break;
         case 'img8':
             File::delete('images/pubImages/' . $pub->img_8);
             $pub->img_8 = '';
             break;
         default:
             break;
     }
     if ($pub->save()) {
         return Response::json(array('type' => 'success'));
     } else {
         return Response::json(array('type' => 'danger'));
     }
 }
 public function agregarPublicacion(Publicaciones $publicaciones)
 {
     try {
         $codigoPublicacion = $publicaciones->getCodigoPublicacion();
         $cedula = $publicaciones->getCedula();
         $area = $publicaciones->getArea();
         $tipo_publicacion = $publicaciones->getTipo_publicacion();
         $editorial = $publicaciones->getEditorial();
         $numeropublicacion = $publicaciones->getNumeropublicacion();
         $puntajeanio = $publicaciones->getPuntajeanio();
         $fechaPublicacion = $publicaciones->getFechaPublicacion();
         $descripcion = $publicaciones->getDescripcion();
         $link = conectarse();
         $Sql = "SELECT sp_ingresarPublicacion('{$cedula}','{$area}','{$tipo_publicacion}','{$editorial}','{$numeropublicacion}','{$puntajeanio}','{$fechaPublicacion}','{$descripcion}')";
         $result = pg_query($link, $Sql);
         return $result;
         pg_close($link);
     } catch (Exception $ex) {
         echo "No se pudo pudieron ingresar los datos Error" . $ex->getMessage();
     }
 }
 public function postReactivate($id)
 {
     $pub = Publicaciones::find($id);
     if ($pub->tipo == 'Lider') {
         $data = Input::all();
         $rules = array('duration' => 'required', 'time' => 'required', 'ubication' => 'required', 'cat' => 'required_if:ubication,Categoria', 'fechIni' => 'required|after:' . date('d-m-Y', time()) . '|date_format:d-m-Y');
         $msg = array();
         $attr = array('duration' => 'duración', 'time' => 'período', 'fechIni' => 'fecha de inicio');
         $validator = Validator::make($data, $rules, $msg, $attr);
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator);
         }
         /* Validar duracion y montos */
         $dur = $data['duration'];
         if ($data['time'] == 'd') {
             $time = 86400;
             $monto = Precios::where('pub_type_id', '=', 1)->where('desc', '=', 'dia')->pluck('precio');
         } elseif ($data['time'] == 's') {
             $time = 604800;
             $monto = Precios::where('pub_type_id', '=', 1)->where('desc', '=', 'semana')->pluck('precio');
         } elseif ($data['time'] == 'm') {
             $time = 2629744;
             $monto = Precios::where('pub_type_id', '=', 1)->where('desc', '=', 'mes')->pluck('precio');
         }
         $monto = $monto * $dur;
         /* Segundo validador de fecha */
         $fecha = explode('-', $data['fechIni']);
         $timestamp = strtotime($data['fechIni']) + $time * $data['duration'];
         $fechaFin = date('d-m-Y', $timestamp);
         $timestamp = $data['duration'] * $time;
         $date = date('d-m-Y');
         $timestamp = strtotime($data['fechIni']) + $timestamp;
         $fechFin = date('Y-m-d', $timestamp);
         $pub = Publicaciones::find($id);
         $pub->ubicacion = $data['ubication'];
         if ($data['ubication'] == 'Categoria') {
             $pub->categoria = $data['cat'];
         }
         $pub->monto = $monto;
         $pub->fechIni = date('Y-m-d', strtotime($data['fechIni']));
         $pub->fechFin = $fechFin;
         $pub->status = 'Pendiente';
         $pub->save();
     } else {
         $input = Input::all();
         $precio = Precios::all();
         $solo = $precio[0];
         if (!empty($input['durationPrin']) && !empty($input['periodoPrin']) && !empty($input['durationCat']) && !empty($input['periodoCat'])) {
             if ($input['periodoPrin'] == $precio[0]->precio) {
                 $publication->duracion = $input['durationPrin'] * 86400;
                 $publication->monto = $input['durationPrin'] * $precio[0]->precio + $publication->monto;
             } elseif ($input['periodoPrin'] == $precio[1]->precio) {
                 $publication->duracion = $input['durationPrin'] * 604800;
                 $publication->monto = $input['durationPrin'] * $precio[1]->precio + $publication->monto;
             } elseif ($input['periodoPrin'] == $precio[2]->precio) {
                 $publication->duracion = $input['durationPrin'] * 2629744;
                 $publication->monto = $input['durationPrin'] * $precio[2]->precio + $publication->monto;
             }
             if ($input['periodoCat'] == $precio[3]->precio) {
                 $publication->duracionNormal = $input['durationCat'] * 86400 + 6048000;
                 $publication->monto = $input['durationCat'] * $precio[3]->precio + $publication->monto;
             } elseif ($input['periodoCat'] == $precio[4]->precio) {
                 $publication->duracionNormal = $input['durationCat'] * 604800 + 6048000;
                 $publication->monto = $input['durationCat'] * $precio[4]->precio + $publication->monto;
             } elseif ($input['periodoCat'] == $precio[5]->precio) {
                 $publication->duracionNormal = $input['durationCat'] * 2629744 + 6048000;
                 $publication->monto = $input['durationCat'] * $precio[5]->precio + $publication->monto;
             }
             $publication->ubicacion = "Ambos";
         } elseif (!empty($input['durationPrin']) && !empty($input['periodoPrin'])) {
             if ($input['periodoPrin'] == $precio[0]->precio) {
                 $publication->duracion = $input['durationPrin'] * 86400;
                 $publication->monto = $input['durationPrin'] * $precio[0]->precio + $publication->monto;
             } elseif ($input['periodoPrin'] == $precio[1]->precio) {
                 $publication->duracion = $input['durationPrin'] * 604800;
                 $publication->monto = $input['durationPrin'] * $precio[1]->precio + $publication->monto;
             } elseif ($input['periodoPrin'] == $precio[2]->precio) {
                 $publication->duracion = $input['durationPrin'] * 2629744;
                 $publication->monto = $input['durationPrin'] * $precio[2]->precio + $publication->monto;
             }
             $publication->ubicacion = 'Principal';
         } elseif (!empty($input['durationCat']) && !empty($input['periodoCat'])) {
             if ($input['periodoCat'] == $precio[3]->precio) {
                 $publication->duracionNormal = $input['durationCat'] * 86400 + 6048000;
                 $publication->monto = $input['durationCat'] * $precio[3]->precio + $publication->monto;
             } elseif ($input['periodoCat'] == $precio[4]->precio) {
                 $publication->duracionNormal = $input['durationCat'] * 604800 + 6048000;
                 $publication->monto = $input['durationCat'] * $precio[4]->precio + $publication->monto;
             } elseif ($input['periodoCat'] == $precio[5]->precio) {
                 $publication->duracionNormal = $input['durationCat'] * 2629744 + 6048000;
                 $publication->monto = $input['durationCat'] * $precio[5]->precio + $publication->monto;
             }
             $publication->ubicacion = 'Categoria';
         } else {
             $publication->duracionNormal = 6048000;
             $publication->ubicacion = 'Categoria';
         }
         $publication->save();
         $publication = Publicaciones::find($input['enviarId']);
         Session::flash('success', 'Publicación creada sactisfactoriamente');
         return Redirect::to('usuario/publicaciones/pago/' . $publication->id);
     }
     Session::flash('success', 'Su publicación se actualizo sactisfactoriamente.');
     return Redirect::to('usuario/publicaciones/pago/' . $pub->id);
 }
Example #5
0
     //Inicializamos la vista Correspondiente
     $princ_view = new Transferencia();
     //Se procede a la creacion de la vista
     $princ_view->DisplayContent($idioma, $a, $b, $c);
     //a b c vienen rellnados cuando se incluye la vista correspondiente
     break;
 case $identificadores['Colaboraciones']:
     //Inicializamos la vista Correspondiente
     $princ_view = new Colaboraciones();
     //Se procede a la creacion de la vista
     $princ_view->DisplayContent($idioma, $e, $in, $g);
     //e in g vienen rellnados cuando se incluye la vista correspondiente
     break;
 case $identificadores['Publicaciones']:
     //Inicializamos la vista Correspondiente
     $princ_view = new Publicaciones();
     //Se procede a la creacion de la vista
     $princ_view->DisplayContent($idioma, $a, $b, $c);
     //e in g vienen rellnados cuando se incluye la vista correspondiente
     break;
 case $identificadores['Actividades']:
     //Inicializamos la vista Correspondiente
     $princ_view = new Actividades();
     //Se procede a la creacion de la vista
     $princ_view->DisplayContent($idioma, $a, $b, $c);
     //e in g vienen rellnados cuando se incluye la vista correspondiente
     break;
 case $identificadores['Docencia']:
     //Inicializamos la vista Correspondiente
     $princ_view = new Docencia();
     //Se procede a la creacion de la vista
 public function postElimPub()
 {
     $id = Input::get('id');
     $motivo = Input::get('motivo');
     $pub = Publicaciones::find($id);
     $titulo = $pub->titulo;
     $comment = Comentarios::where('pub_id', '=', $id)->get();
     $resp = Respuestas::where('pub_id', '=', $id)->get();
     if (count($comment) > 0) {
         foreach ($comment as $c) {
             $c->deleted = 1;
             $c->save();
         }
     }
     if (count($resp) > 0) {
         foreach ($resp as $r) {
             $r->deleted = 1;
             $r->save();
         }
     }
     $user = User::find($pub->user_id);
     $subject = "Correo de Aviso";
     $data = array('subject' => $subject, 'publicacion' => $titulo, 'motivo' => $motivo);
     $to_Email = $user->email;
     Mail::send('emails.elimPubUser', $data, function ($message) use($titulo, $to_Email, $subject) {
         $message->to($to_Email)->from('*****@*****.**')->subject($subject);
     });
     $pub->deleted = 1;
     $pub->save();
     $subject = "Correo de administrador";
     $admin = Auth::user()['username'];
     $data = array('subject' => $subject, 'publicacion' => $titulo, 'creadoPor' => $admin);
     $to_Email = '*****@*****.**';
     Mail::send('emails.elmPub', $data, function ($message) use($titulo, $admin, $to_Email, $subject) {
         $message->to($to_Email)->from('*****@*****.**')->subject($subject);
     });
     return Response::json(array('type' => 'success', 'msg' => 'Publicación eliminada satisfactoriamente. Hemos enviado un email al correo.'));
 }
 public function getSearch()
 {
     $title = "Búsqueda | pasillo24.com";
     $paginatorFilter = "";
     if (Input::has('busq')) {
         $busq = Input::get('busq');
         $auxLider = Publicaciones::leftJoin('categoria', 'categoria.id', '=', 'publicaciones.categoria')->where('publicaciones.status', '=', 'Aprobado')->where('publicaciones.deleted', '=', 0)->where(function ($query) {
             $query->where('publicaciones.ubicacion', '=', 'Categoria')->orWhere('publicaciones.ubicacion', '=', 'Ambos');
         })->where(function ($query) {
             $query->where('publicaciones.fechFin', '>=', date('Y-m-d'))->orWhere('publicaciones.fechFinNormal', '>=', date('Y-m-d'));
         })->where(function ($query) use($busq) {
             $query->whereRaw("LOWER(`publicaciones`.`titulo`) LIKE  '%" . strtolower($busq) . "%'")->orWhereRaw("LOWER(`publicaciones`.`pag_web`) LIKE  '%" . strtolower($busq) . "%'")->orWhereRaw("LOWER(`categoria`.`desc`) LIKE  '%" . strtolower($busq) . "%'");
         });
         $auxRes = Publicaciones::leftJoin('categoria', 'publicaciones.categoria', '=', 'categoria.id')->leftJoin('departamento', 'publicaciones.departamento', '=', 'departamento.id')->where(function ($query) use($busq) {
             $query->whereRaw("LOWER(`publicaciones`.`titulo`) LIKE  '%" . strtolower($busq) . "%'")->orWhereRaw("LOWER(`departamento`.`nombre`) LIKE  '%" . strtolower($busq) . "%'")->orWhereRaw("LOWER(`categoria`.`desc`) LIKE  '%" . strtolower($busq) . "%'");
         })->where(function ($query) {
             $query->where('publicaciones.fechFin', '>=', date('Y-m-d'))->orWhere('publicaciones.fechFinNormal', '>=', date('Y-m-d'));
         })->where('publicaciones.tipo', '!=', 'Lider')->where('publicaciones.status', '=', 'Aprobado')->where('publicaciones.deleted', '=', 0);
         /*Se agrega*/
         if (Input::has('filter')) {
             $filter = Input::get('filter');
             if ($filter != -1) {
                 $filter = Department::find(Input::get('filter'));
                 $auxRes = $auxRes->where('publicaciones.departamento', '=', $filter->id);
                 $paginatorFilter .= '&filter=' . $filter->id;
             } else {
                 $filter = "";
             }
         }
         if (Input::has('min') || Input::has('max')) {
             $min = Input::get('min');
             $max = Input::get('max');
             $currency = Input::get('currency');
             if (!is_null($min) && !is_null($max) && !empty($min) && !empty($max)) {
                 $minmax = array($min, $max);
                 $paginatorFilter .= '&min=' . $min . '&max=' . $max . '&currency=' . $currency;
                 $auxLider = $auxLider->where('moneda', '=', $currency)->where('precio', '>=', $min)->whereRaw('`publicaciones`.`precio` <= ' . $max);
                 $auxRes = $auxRes->where('publicaciones.precio', '>=', $min)->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('publicaciones.moneda', '=', $currency);
             } else {
                 if (!is_null($max) && !empty($max)) {
                     $minmax = array('', $max);
                     $paginatorFilter .= '&max=' . $max . '&currency=' . $currency;
                     $auxLider = $auxLider->where('moneda', '=', $currency)->whereRaw('`publicaciones`.`precio` <= ' . $max);
                     $auxRes = $auxRes->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('publicaciones.moneda', '=', $currency);
                 } elseif (!is_null($min) && !empty($min)) {
                     $minmax = array($min, '');
                     $paginatorFilter .= '&min=' . $min . '&currency=' . $currency;
                     $auxLider = $auxLider->where('moneda', '=', $currency)->where('precio', '>=', $min);
                     $auxRes = $auxRes->where('publicaciones.moneda', '=', $currency)->where('publicaciones.precio', '>=', $min);
                 }
             }
         }
         if (Input::has('rel')) {
             $rel = Input::get('rel');
             switch ($rel) {
                 case 'rep':
                     $auxLider = $auxLider->leftJoin('usuario', 'usuario.id', '=', 'publicaciones.user_id')->orderBy('usuario.reputation', 'DESC');
                     $auxRes = $auxRes->leftJoin('usuario', 'usuario.id', '=', 'publicaciones.user_id')->orderBy('usuario.reputation', 'DESC');
                     $paginatorFilter .= '&rel=rep';
                     break;
                 case 'fin':
                     $auxLider = $auxLider->orderBy('publicaciones.fechFin', 'ASC')->orderBy('publicaciones.fechFinNormal', 'ASC');
                     $auxRes = $auxRes->orderBy('publicaciones.fechFin', 'ASC')->orderBy('publicaciones.fechFinNormal', 'ASC');
                     $paginatorFilter .= '&rel=fin';
                     break;
                 case 'ini':
                     $auxLider = $auxLider->orderBy('publicaciones.fechIni', 'DESC')->orderBy('publicaciones.fechIniNormal', 'DESC');
                     $auxRes = $auxRes->orderBy('publicaciones.fechIni', 'DESC')->orderBy('publicaciones.fechIniNormal', 'DESC');
                     $paginatorFilter .= '&rel=ini';
                     break;
                 default:
                     break;
             }
         }
         if (Input::has('cond')) {
             $cond = Input::get('cond');
             $paginatorFilter .= '&cond=' . $cond;
             $auxRes = $auxRes->where('publicaciones.condicion', '=', strtolower($cond));
         }
         if (Input::has('buss')) {
             $buss = Input::get('buss');
             $paginatorFilter .= '&buss=' . $buss;
             $auxLider = $auxLider->where('publicaciones.bussiness_type', '=', strtolower($buss));
             $auxRes = $auxRes->where('publicaciones.bussiness_type', '=', strtolower($buss));
         }
         $lider = $auxLider->get(array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda'));
         $res = $auxRes->paginate(5, array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda', 'publicaciones.descripcion', 'publicaciones.fechFin', 'publicaciones.fechFinNormal', 'departamento.id as dep_id', 'departamento.nombre as dep'));
         $categorias = Categorias::where('id', '=', $busq)->pluck('desc');
         if (!is_null($categorias)) {
             $busq = $categorias;
         } else {
             $busq = $busq;
         }
         $departamentos = Department::get();
         $view = View::make('publications.busq')->with('publicaciones', $res)->with('title', $title)->with('busq', $busq)->with('lider', $lider)->with('departamento', $departamentos)->with('paginatorFilter', $paginatorFilter);
         if (isset($filter)) {
             $view = $view->with('filter', $filter);
         }
         if (isset($currency)) {
             $view = $view->with('minmax', $minmax)->with('currency', $currency);
         }
         if (isset($cond)) {
             $view = $view->with('cond', $cond);
         }
         if (isset($buss)) {
             $view = $view->with('buss', $buss);
         }
         if (isset($rel)) {
             $view = $view->with('rel', $rel);
         }
         return $view;
     } elseif (Input::has('cat')) {
         $id = Input::geT('cat');
         /*Query inicial*/
         $auxLider = Publicaciones::where('status', '=', 'Aprobado')->where('deleted', '=', 0)->where(function ($query) {
             $query->where('ubicacion', '=', 'Categoria')->orWhere('ubicacion', '=', 'Ambos');
         })->where(function ($query) {
             $query->where('fechFin', '>=', date('Y-m-d'))->orWhere('fechFinNormal', '>=', date('Y-m-d'));
         })->where('categoria', '=', $id);
         //->get(array('id','img_1','titulo','precio','moneda'));
         $auxRes = Publicaciones::leftJoin('departamento', 'publicaciones.departamento', '=', 'departamento.id')->where('publicaciones.status', '=', 'Aprobado')->where('publicaciones.categoria', '=', $id)->where('publicaciones.tipo', '!=', 'Lider')->where('publicaciones.deleted', '=', 0)->where(function ($query) {
             $query->where('publicaciones.ubicacion', '=', 'Categoria')->orWhere('publicaciones.ubicacion', '=', 'Ambos');
         })->where(function ($query) {
             $query->where('publicaciones.fechFin', '>=', date('Y-m-d', time()))->orWhere('publicaciones.fechFinNormal', '>=', date('Y-m-d', time()));
         });
         /*Se agrega*/
         if (Input::has('filter')) {
             $filter = Input::get('filter');
             if ($filter != -1) {
                 $filter = Department::find(Input::get('filter'));
                 $auxRes = $auxRes->where('publicaciones.departamento', '=', $filter->id);
                 $paginatorFilter .= '&filter=' . $filter->id;
             } else {
                 $filter = "";
             }
         }
         if (Input::has('min') || Input::has('max')) {
             $min = Input::get('min');
             $max = Input::get('max');
             $currency = Input::get('currency');
             if (!is_null($min) && !is_null($max) && !empty($min) && !empty($max)) {
                 $minmax = array($min, $max);
                 $paginatorFilter .= '&min=' . $min . '&max=' . $max . '&currency=' . $currency;
                 $auxLider = $auxLider->whereRaw('`publicaciones`.`precio` >= ' . $min)->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('moneda', '=', $currency);
                 $auxRes = $auxRes->whereRaw('`publicaciones`.`precio` >= ' . $min)->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('publicaciones.moneda', '=', $currency);
             } else {
                 if (!is_null($max) && !empty($max)) {
                     $minmax = array('', $max);
                     $paginatorFilter .= '&max=' . $max . '&currency=' . $currency;
                     $auxLider = $auxLider->where('moneda', '=', $currency)->whereRaw('`publicaciones`.`precio` <= ' . $max);
                     $auxRes = $auxRes->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('publicaciones.moneda', '=', $currency);
                 } elseif (!is_null($min) && !empty($min)) {
                     $minmax = array($min, '');
                     $paginatorFilter .= '&min=' . $min . '&currency=' . $currency;
                     $auxLider = $auxLider->whereRaw('`publicaciones`.`precio` >= ' . $min)->where('moneda', '=', $currency);
                     $auxRes = $auxRes->where('publicaciones.moneda', '=', $currency)->whereRaw('`publicaciones`.`precio` >= ' . $min);
                 }
             }
         }
         if (Input::has('rel')) {
             $rel = Input::get('rel');
             switch ($rel) {
                 case 'rep':
                     $auxLider = $auxLider->leftJoin('usuario', 'usuario.id', '=', 'publicaciones.user_id')->orderBy('usuario.reputation', 'DESC');
                     $auxRes = $auxRes->leftJoin('usuario', 'usuario.id', '=', 'publicaciones.user_id')->orderBy('usuario.reputation', 'DESC');
                     $paginatorFilter .= '&rel=rep';
                     break;
                 case 'fin':
                     $auxLider = $auxLider->orderBy('publicaciones.fechFin', 'ASC')->orderBy('publicaciones.fechFinNormal', 'ASC');
                     $auxRes = $auxRes->orderBy('publicaciones.fechFin', 'ASC')->orderBy('publicaciones.fechFinNormal', 'ASC');
                     $paginatorFilter .= '&rel=fin';
                     break;
                 case 'ini':
                     $auxLider = $auxLider->orderBy('publicaciones.fechIni', 'DESC')->orderBy('publicaciones.fechIniNormal', 'DESC');
                     $auxRes = $auxRes->orderBy('publicaciones.fechIni', 'DESC')->orderBy('publicaciones.fechIniNormal', 'DESC');
                     $paginatorFilter .= '&rel=ini';
                     break;
                 default:
                     break;
             }
         }
         if (Input::has('cond')) {
             $cond = Input::get('cond');
             $paginatorFilter .= '&cond=' . $cond;
             $auxRes = $auxRes->where('publicaciones.condicion', '=', strtolower($cond));
         }
         if (Input::has('buss')) {
             $buss = Input::get('buss');
             $paginatorFilter .= '&buss=' . $buss;
             $auxLider = $auxLider->where('publicaciones.bussiness_type', '=', strtolower($buss));
             $auxRes = $auxRes->where('publicaciones.bussiness_type', '=', strtolower($buss));
         }
         $lider = $auxLider->get(array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda'));
         $res = $auxRes->paginate(5, array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda', 'publicaciones.descripcion', 'publicaciones.fechFin', 'publicaciones.fechFinNormal', 'departamento.id as dep_id', 'departamento.nombre as dep'));
         $categorias = Categorias::where('id', '=', $id)->pluck('id');
         if (!is_null($categorias)) {
             $busq = $categorias;
         } else {
             $busq = $id;
         }
         $departamentos = Department::get();
         $view = View::make('publications.categories')->with('publicaciones', $res)->with('title', $title)->with('busq', $busq)->with('lider', $lider)->with('departamento', $departamentos)->with('paginatorFilter', $paginatorFilter);
         if (isset($filter)) {
             $view = $view->with('filter', $filter);
         }
         if (isset($currency)) {
             $view = $view->with('minmax', $minmax)->with('currency', $currency);
         }
         if (isset($cond)) {
             $view = $view->with('cond', $cond);
         }
         if (isset($buss)) {
             $view = $view->with('buss', $buss);
         }
         if (isset($rel)) {
             $view = $view->with('rel', $rel);
         }
         return $view;
     }
 }