2021-12-30 11:49:40 -03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Route;
|
2022-01-11 17:24:46 -03:00
|
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
2021-12-30 11:49:40 -03:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Web Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Here is where you can register web routes for your application. These
|
|
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
|
|
| contains the "web" middleware group. Now create something great!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2022-05-19 15:30:11 -03:00
|
|
|
if (App::environment('production')) {
|
|
|
|
URL::forceScheme('https');
|
|
|
|
}
|
|
|
|
|
2022-01-08 02:53:00 -03:00
|
|
|
Route::get('/', 'ProductoController@index')->name('productos');
|
|
|
|
|
2022-01-08 23:56:37 -03:00
|
|
|
Auth::routes(['register' => false]);
|
|
|
|
|
|
|
|
Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
|
|
|
|
2022-03-31 17:48:08 -03:00
|
|
|
Route::get('/chismosa', 'ChismosaController@show')->name('chismosa.show');
|
|
|
|
|
2022-01-11 17:24:46 -03:00
|
|
|
Route::middleware('auth')->group( function() {
|
|
|
|
|
|
|
|
Route::name('subpedidos.')->prefix("subpedidos")->group( function() {
|
|
|
|
Route::get('/', function() {
|
|
|
|
return view('subpedidos_create');
|
|
|
|
})->name('create');
|
2022-03-31 17:48:08 -03:00
|
|
|
|
2022-01-11 17:24:46 -03:00
|
|
|
Route::post('guardar_sesion', function() {
|
|
|
|
$r = request();
|
|
|
|
if (!isset($r["subpedido"])) {
|
|
|
|
throw new HttpException(400, "La request necesita un subpedido para guardar en sesión");
|
|
|
|
}
|
|
|
|
session(["subpedido_nombre" => $r["subpedido"]["nombre"]]);
|
|
|
|
session(["subpedido_id" => $r["subpedido"]["id"]]);
|
|
|
|
return "Subpedido guardado en sesión";
|
|
|
|
})->name('guardarSesion');
|
2022-02-24 19:07:58 -03:00
|
|
|
|
|
|
|
Route::get('obtener_sesion', function() {
|
|
|
|
$sesion = [
|
|
|
|
'subpedido' => [
|
|
|
|
'nombre' => session("subpedido_nombre"),
|
|
|
|
'id' => session("subpedido_id")
|
|
|
|
]
|
|
|
|
];
|
|
|
|
return $sesion;
|
|
|
|
})->name('obtenerSesion');
|
2022-01-11 17:24:46 -03:00
|
|
|
});
|
|
|
|
});
|