Esempio n. 1
0
 public function listadoCategoria($categoria = null)
 {
     $categoria_id = Categoria::where('slug', '=', $categoria)->pluck('id');
     if (is_null($categoria_id)) {
         App::abort(404);
     }
     $articulos = Articulo::where('categoria_id', '=', $categoria_id)->orderBy('updated_at', 'desc')->paginate(4);
     $categorias = Categoria::all();
     return View::make('blog::listado')->with(array('articulos' => $articulos, 'categoria_seleccionada' => $categoria, 'categorias' => $categorias));
 }
 public function vistaListado()
 {
     $items = Item::where('estado', 'A')->get();
     $categorias = Categoria::where('estado', 'A')->get();
     $secciones = Seccion::where('estado', 'A')->get();
     $this->array_view['items'] = $items;
     $this->array_view['categorias'] = $categorias;
     $this->array_view['secciones'] = $secciones;
     //Hace que se muestre el html lista.blade.php de la carpeta item
     //con los parametros pasados por el array
     return View::make($this->folder_name . '.lista', $this->array_view);
 }
 public function vistaEditar($id)
 {
     //Me quedo con la categoria, buscando por id
     //$categoria = Categoria::find($id);
     $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first();
     $categoria = Categoria::join('categoria_lang', 'categoria_lang.categoria_id', '=', 'categoria.id')->where('categoria_lang.lang_id', $lang->id)->where('categoria_lang.estado', 'A')->where('categoria.id', $id)->first();
     $categorias = Categoria::where('estado', 'A')->where('id', '<>', $id)->get();
     $this->array_view['categoria'] = $categoria;
     $this->array_view['categorias'] = $categorias;
     if ($categoria) {
         return View::make($this->folder_name . '.editar', $this->array_view);
     } else {
         $this->array_view['texto'] = Lang::get('controllers.error_carga_pagina');
         return View::make($this->project_name . '-error', $this->array_view);
     }
 }
 public function vistaListado()
 {
     $items_borrados = Item::where('estado', 'B')->lists('id');
     if (count($items_borrados) > 0) {
         $portfolios = Portfolio::whereNotIn('item_id', $items_borrados)->get();
     } else {
         $portfolios = Portfolio::all();
     }
     $categorias = Categoria::where('estado', 'A')->get();
     $secciones = Seccion::where('estado', 'A')->get();
     $this->array_view['portfolios'] = $portfolios;
     $this->array_view['categorias'] = $categorias;
     $this->array_view['secciones'] = $secciones;
     //Hace que se muestre el html lista.blade.php de la carpeta item
     //con los parametros pasados por el array
     return View::make($this->folder_name . '.lista', $this->array_view);
 }
Esempio n. 5
0
 public static function Ajax($param)
 {
     switch ($param) {
         case 'all':
             // All method
             $categorias = self::all()->toJson();
             echo $categorias;
             // All method end
             break;
         case 'getName':
             $name = Categoria::where("id_marelli", "=", e(Input::get('id')))->take(1)->get()->toJson();
             echo $name;
             break;
         default:
             # code...
             break;
     }
 }
Esempio n. 6
0
 /**
  * Display a listing of the resource.
  * GET /categorias
  *
  * @return Response
  */
 public function getIndex()
 {
     $categorias = Categoria::where('id', '>', 1)->get();
     return View::make('categorias.index', compact('categorias'));
 }
Esempio n. 7
0
 public function getEdit2($id = NULL)
 {
     if (isset($id)) {
         $producto = Producto::find($id);
         $unidades = Unidadmedida::all()->lists('nombre', 'id');
         $categorias = Categoria::where('id', '>', 1)->lists('nombre', 'id');
         return View::make('productos.edit', compact('producto', 'categorias', 'unidades'));
     } else {
         return Redirect::to('/productos');
     }
 }
 protected function desplegarCategoria()
 {
     /*
      * FILTRO PARA MOSTRAR SOLAMENTE LOS MENU PADRE
      */
     $categorias_asociadas = DB::table('categoria_asociada')->where('estado', 'A')->lists('categoria_id_asociada');
     if ($categorias_asociadas) {
         $categorias = Categoria::where('estado', 'A')->whereNotIn('id', $categorias_asociadas)->get();
     } else {
         $categorias = Categoria::where('estado', 'A')->get();
     }
     return $categorias;
 }