Endpoint mostrar detalles de producto
This commit is contained in:
		
							parent
							
								
									2c2b921919
								
							
						
					
					
						commit
						b79ea6d1ed
					
				
					 3 changed files with 23 additions and 11 deletions
				
			
		|  | @ -33,7 +33,7 @@ class Filtro extends Model | |||
|         $filtros = $this->request->all(); | ||||
| 
 | ||||
|         //el filtro nombre debe tomar precedencia sobre otros como (alfabetico)
 | ||||
|         if ($filtros["nombre"]) { | ||||
|         if (isset($filtros["nombre"])) { | ||||
|             $nombre = $filtros["nombre"]; | ||||
|             unset($filtros["nombre"]); | ||||
|             $filtros = array_merge(["nombre" => $nombre],$filtros); | ||||
|  |  | |||
|  | @ -21,4 +21,15 @@ class ProductoController extends Controller | |||
|         return Producto::filtrar($filtros)->paginate(Producto::getPaginar($request)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Display the specified resource. | ||||
|      * | ||||
|      * @param  \App\Producto  $producto | ||||
|      * @return \Illuminate\Http\Response | ||||
|      */ | ||||
|     public function show(Producto $producto) | ||||
|     { | ||||
|         return $producto; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -28,18 +28,19 @@ Route::middleware('api')->group(function () { | |||
|     	}); | ||||
|     }); | ||||
| 
 | ||||
|     //@TO DO -> esta ruta debe estar en middleware de subpedido
 | ||||
|     Route::get('/categorias', function() { | ||||
| 		return Producto::all()->pluck('categoria')->unique()->flatten(); | ||||
| 	}); | ||||
| 
 | ||||
|     //@TO DO -> esta ruta debe estar en middleware de subpedido
 | ||||
| 	Route::prefix('productos')->group(function () { | ||||
| 		Route::get('/','Api\ProductoController@index'); | ||||
| 	}); | ||||
| 
 | ||||
|     Route::prefix('subpedidos')->group(function () { | ||||
|         Route::get('/','Api\SubpedidoController@index'); | ||||
|         Route::post('/','Api\SubpedidoController@store'); | ||||
|     }); | ||||
| 
 | ||||
|     //@TO DO -> esta ruta debe estar en middleware de auth y/o subpedido
 | ||||
|     Route::get('/categorias', function() { | ||||
| 		return Producto::all()->pluck('categoria')->unique()->flatten(); | ||||
| 	}); | ||||
| 
 | ||||
|     //@TO DO -> esta ruta debe estar en middleware de auth y/o subpedido
 | ||||
| 	Route::prefix('productos')->group(function () { | ||||
|         Route::get('/','Api\ProductoController@index'); | ||||
| 		Route::get('{producto}','Api\ProductoController@show'); | ||||
| 	}); | ||||
| }); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 nat
						nat