Agregado middleware autorizacion admin
This commit is contained in:
parent
f4d269721a
commit
3f34483fd5
|
@ -56,6 +56,7 @@ class Kernel extends HttpKernel
|
|||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'admin' => \App\Http\Middleware\Admin::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Auth;
|
||||
|
||||
class Admin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$user = Auth::user();
|
||||
if ($user->is_admin) {
|
||||
return $next($request);
|
||||
} else {
|
||||
return response('Necesitás ser admin para hacer esto', 403);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2974,6 +2974,14 @@ __webpack_require__.r(__webpack_exports__);
|
|||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
/* harmony default export */ __webpack_exports__["default"] = ({
|
||||
name: "SubpedidosGdc",
|
||||
|
@ -5940,6 +5948,21 @@ var render = function () {
|
|||
},
|
||||
[
|
||||
_c("div", { staticClass: "buttons is-right" }, [
|
||||
_c(
|
||||
"a",
|
||||
{
|
||||
staticClass: "button is-success",
|
||||
attrs: { href: "/admin/exportar-pedido-a-csv/" + _vm.gdc },
|
||||
},
|
||||
[
|
||||
_c("span", [
|
||||
_vm._v("\n Exportar pedido barrial\n "),
|
||||
]),
|
||||
_vm._v(" "),
|
||||
_vm._m(0),
|
||||
]
|
||||
),
|
||||
_vm._v(" "),
|
||||
_c(
|
||||
"a",
|
||||
{
|
||||
|
@ -5951,7 +5974,7 @@ var render = function () {
|
|||
_vm._v("\n Imprimir Planillas\n "),
|
||||
]),
|
||||
_vm._v(" "),
|
||||
_vm._m(0),
|
||||
_vm._m(1),
|
||||
]
|
||||
),
|
||||
]),
|
||||
|
@ -5970,7 +5993,7 @@ var render = function () {
|
|||
staticClass: "table is-fullwidth is-striped is-bordered",
|
||||
},
|
||||
[
|
||||
_vm._m(1),
|
||||
_vm._m(2),
|
||||
_vm._v(" "),
|
||||
_c("tfoot", [
|
||||
_c("tr", [
|
||||
|
@ -6018,6 +6041,14 @@ var render = function () {
|
|||
)
|
||||
}
|
||||
var staticRenderFns = [
|
||||
function () {
|
||||
var _vm = this
|
||||
var _h = _vm.$createElement
|
||||
var _c = _vm._self._c || _h
|
||||
return _c("span", { staticClass: "icon is-small" }, [
|
||||
_c("i", { staticClass: "fas fa-download" }),
|
||||
])
|
||||
},
|
||||
function () {
|
||||
var _vm = this
|
||||
var _h = _vm.$createElement
|
||||
|
@ -19560,8 +19591,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
__webpack_require__(/*! /home/ale/MPS/App/pedi2/resources/js/app.js */"./resources/js/app.js");
|
||||
module.exports = __webpack_require__(/*! /home/ale/MPS/App/pedi2/resources/sass/app.scss */"./resources/sass/app.scss");
|
||||
__webpack_require__(/*! /var/www/resources/js/app.js */"./resources/js/app.js");
|
||||
module.exports = __webpack_require__(/*! /var/www/resources/sass/app.scss */"./resources/sass/app.scss");
|
||||
|
||||
|
||||
/***/ })
|
||||
|
|
|
@ -25,8 +25,6 @@ Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
|||
|
||||
Route::get('/admin', 'AdminController@show')->name('admin_login.show');
|
||||
|
||||
Route::get('/admin/pedidos', 'AdminController@index')->name('admin_login.index');
|
||||
|
||||
Route::get('/admin/obtener_sesion', function() {
|
||||
$sesion = [
|
||||
'gdc' => session("admin_gdc")
|
||||
|
@ -34,11 +32,12 @@ Route::get('/admin/obtener_sesion', function() {
|
|||
return $sesion;
|
||||
})->name('admin_obtener_sesion');
|
||||
|
||||
Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPlanillasAPdf');
|
||||
Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
|
||||
|
||||
Route::middleware(['auth', 'admin'])->group( function () {
|
||||
//Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPlanillasAPdf');
|
||||
Route::get('/admin/pedidos', 'AdminController@index')->name('admin_login.index');
|
||||
|
||||
Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPlanillasAPdf');
|
||||
|
||||
Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
|
||||
});
|
||||
|
||||
Route::middleware('auth')->group( function() {
|
||||
|
|
Loading…
Reference in New Issue