2022-01-05 18:14:21 -03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use Illuminate\Http\Request;
|
2022-01-07 18:02:48 -03:00
|
|
|
use App\Filtros\FiltroDeProducto;
|
2022-01-13 20:15:46 -03:00
|
|
|
use App\Http\Resources\ProductoResource;
|
2022-01-05 18:14:21 -03:00
|
|
|
use App\Producto;
|
|
|
|
|
|
|
|
class ProductoController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Mostrar una lista de productos.
|
|
|
|
*
|
2022-01-07 18:02:48 -03:00
|
|
|
* @param App\Filtros\FiltroDeProducto $filtros
|
2022-01-05 18:14:21 -03:00
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
2022-01-07 18:02:48 -03:00
|
|
|
public function index(FiltroDeProducto $filtros, Request $request)
|
2022-01-05 18:14:21 -03:00
|
|
|
{
|
2022-01-13 20:15:46 -03:00
|
|
|
return ProductoResource::collection(Producto::filtrar($filtros)->paginate(Producto::getPaginar($request)));
|
2022-01-05 18:14:21 -03:00
|
|
|
}
|
|
|
|
|
2022-01-12 10:53:44 -03:00
|
|
|
/**
|
|
|
|
* Display the specified resource.
|
|
|
|
*
|
|
|
|
* @param \App\Producto $producto
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function show(Producto $producto)
|
|
|
|
{
|
|
|
|
return $producto;
|
|
|
|
}
|
|
|
|
|
2022-01-05 18:14:21 -03:00
|
|
|
}
|