forked from nathalie/pedi2
56 lines
1.6 KiB
PHP
56 lines
1.6 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| 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!
|
|
|
|
|
*/
|
|
|
|
if (App::environment('production')) {
|
|
URL::forceScheme('https');
|
|
}
|
|
|
|
Route::get('/', 'ProductoController@index')->name('productos');
|
|
|
|
Auth::routes(['register' => false]);
|
|
|
|
Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
|
|
|
Route::get('/chismosa', 'ChismosaController@show')->name('chismosa.show');
|
|
|
|
Route::middleware('auth')->group( function() {
|
|
|
|
Route::name('subpedidos.')->prefix("subpedidos")->group( function() {
|
|
Route::get('/', function() {
|
|
return view('subpedidos_create');
|
|
})->name('create');
|
|
|
|
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');
|
|
|
|
Route::get('obtener_sesion', function() {
|
|
$sesion = [
|
|
'subpedido' => [
|
|
'nombre' => session("subpedido_nombre"),
|
|
'id' => session("subpedido_id")
|
|
]
|
|
];
|
|
return $sesion;
|
|
})->name('obtenerSesion');
|
|
});
|
|
});
|