Eliminados middlewares no usados + reorden
This commit is contained in:
parent
1e7afc034e
commit
6bcb22ea00
3 changed files with 35 additions and 84 deletions
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Admin
|
||||
{
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$user = Auth::user();
|
||||
if ($user->is_admin) {
|
||||
return $next($request);
|
||||
} else {
|
||||
return response('Necesitás ser admin para hacer esto', 403);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class Compras
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (!Auth::check())
|
||||
return redirect()->route('compras_login.show');
|
||||
|
||||
if (Auth::user()->is_compras) {
|
||||
return $next($request);
|
||||
} else {
|
||||
return response('Necesitás ser de comisión compras para hacer esto', 403);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,27 +20,9 @@ if (App::environment('production')) {
|
|||
URL::forceScheme('https');
|
||||
}
|
||||
|
||||
Route::get('/', 'RouteController@home')->name('home');
|
||||
|
||||
Auth::routes(['register' => false]);
|
||||
|
||||
Route::get('/admin/login', 'AdminController@show')->name('admin.login');
|
||||
|
||||
Route::get('/admin/obtener_sesion', function() {
|
||||
return [
|
||||
'gdc' => session("admin_gdc")
|
||||
];
|
||||
})->name('admin_obtener_sesion');
|
||||
|
||||
Route::middleware(['auth', 'role:admin_barrio'])->group( function () {
|
||||
Route::get('/admin', 'AdminController@index')->name('admin.pedidos');
|
||||
|
||||
Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPedidosAPdf');
|
||||
|
||||
Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
|
||||
|
||||
Route::get('/admin/exportar-pedido-con-nucleos-a-csv/{gdc}', 'AdminController@exportarPedidoConNucleosACSV');
|
||||
});
|
||||
Route::get('/', 'RouteController@home')->name('home');
|
||||
|
||||
Route::middleware(['auth', 'role:barrio'])->group( function() {
|
||||
Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
||||
|
@ -76,6 +58,24 @@ Route::middleware(['auth', 'role:barrio'])->group( function() {
|
|||
});
|
||||
});
|
||||
|
||||
Route::get('/admin/login', 'AdminController@show')->name('admin.login');
|
||||
|
||||
Route::get('/admin/obtener_sesion', function() {
|
||||
return [
|
||||
'gdc' => session("admin_gdc")
|
||||
];
|
||||
})->name('admin_obtener_sesion');
|
||||
|
||||
Route::middleware(['auth', 'role:admin_barrio'])->group( function () {
|
||||
Route::get('/admin', 'AdminController@index')->name('admin.pedidos');
|
||||
|
||||
Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPedidosAPdf');
|
||||
|
||||
Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
|
||||
|
||||
Route::get('/admin/exportar-pedido-con-nucleos-a-csv/{gdc}', 'AdminController@exportarPedidoConNucleosACSV');
|
||||
});
|
||||
|
||||
Route::get('/compras/login', 'ComprasController@show')->name('compras.login');
|
||||
|
||||
Route::middleware(['auth', 'role:comision'])->group( function() {
|
||||
|
|
Loading…
Add table
Reference in a new issue