Esempio n. 1
0
 public static function excluir(Request $req)
 {
     $marca = Marca::find($req->get('id'));
     if ($marca->delete() == false) {
         throw new \Exception('Erro ao excluir registro', 402);
     }
 }
Esempio n. 2
0
 public function pesquisarPorID($id)
 {
     if (request()->ajax()) {
         return response()->json(Marca::find($id)->modelos()->get());
     } else {
         return "Acesso Negado.";
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $marca = Marca::find($id);
     $productoslista = Producto::searchMarcas($id)->searchActivos()->orderBy('nombre', 'ASC')->lists('nombre', 'nombre');
     $tipos = Tipoproducto::orderBy('nombreTipo', 'ASC')->lists('nombreTipo', 'id');
     $productos = Producto::searchMarcas($id)->searchActivos()->orderBy('nombre', 'ASC')->paginate();
     return view('front.marcas.showMarca')->with('tipos', json_decode($tipos, true))->with('productoslista', json_decode($productoslista, true))->with('productos', $productos)->with('marca', $marca);
 }
Esempio n. 4
0
 public static function atualizar(Request $req)
 {
     $modelo = modelo::find($req->get('id'));
     $modelo->nome = $req->get('nome');
     $modelo->marca()->associate(Marca::find($req->get('marca')));
     if ($modelo->save() == false) {
         throw new \Exception('Erro ao grava novo registro.', 402);
     }
     return $modelo;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $marcas = \App\Marca::find($id);
     $marcas->delete();
     return redirect('marcas')->with('message', 'borrado');
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $marca
  * @param  int  $parent_id
  * @return \Illuminate\Http\Response
  */
 public function show($marca, $parent_id)
 {
     $categorias = Categoria::getBySub($marca, $parent_id);
     $ma = Marca::find($marca, ['nombre']);
     $nombre = $ma->nombre;
     return view('admin.listado-categorias', compact('categorias', 'marca', 'nombre'));
 }
});
Route::get('t_articulos', function () {
    $id = Input::get('option');
    $pre = \App\TipoRenglon::find($id)->Renglon->lists('descrip_renglon', 'id_renglon');
    /*array_unshift($pre,'Debe Seleccionar un Articulo');*/
    return $pre;
});
Route::get('marcas', function () {
    $id = Input::get('option');
    $level = \App\Marca::find($id)->modelos->lists('descrip_modelo', 'id_modelo');
    array_unshift($level, 'Debe Seleccionar un Modelo');
    return $level;
});
Route::get('articulo', function () {
    $id = Input::get('option');
    $level = \App\Marca::find($id)->modelos->lists('descrip_modelo', 'id_modelo');
    /*array_unshift($level,'Debe Seleccionar un Modelo');*/
    return $level;
});
Route::get('modal/{id}', function ($id) {
    $seriales = \Illuminate\Support\Facades\DB::table('inventario_seriales')->join('renglones', 'inventario_seriales.id_renglon', '=', 'renglones.id_renglon')->select('inventario_seriales.serial', 'renglones.descrip_renglon')->where('inventario_seriales.id_renglon', '=', $id)->get();
    /*$seriales=\App\Seriales::where('id_renglon','=',$id)->get();*/
    $cantidad = count($seriales);
    echo "<b>Cantidad:</b>" . $cantidad;
    echo "<table class='table  table-condensed table-striped'>";
    echo "<tr>";
    echo "<td style='text-align:center;'>" . '<b>Articulo</b>' . "</td>";
    echo "<td style='text-align:center;'>" . '<b>Seriales</b>' . "</td>";
    /*echo "<td style='text-align:center;'>".'<b>Seriales</b>'."</td>";*/
    echo "</tr>";
    foreach ($seriales as $serial) {
 public function find(Route $route)
 {
     $this->marca = Marca::find($route->getParameter('marcas'));
     // marcas es el atributo que figura junto al nombre de la ruta en el archivo de rutas.
 }
Esempio n. 9
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $marca = Marca::find($id);
         $marca->delete();
         return JsonResponse::create(array('message' => "Marca Eliminada Correctamente", "request" => json_encode($id)), 200);
     } catch (Exception $ex) {
         return JsonResponse::create(array('message' => "No se pudo Eliminar la marca", "exception" => $ex->getMessage(), "request" => json_encode($id)), 401);
     }
 }