Compare commits
No commits in common. "bf3f6972991f2170acc2eaa1abaebbb704d7c699" and "9259248caf28c7508c43d50b148aaba5f9d3ff0f" have entirely different histories.
bf3f697299
...
9259248caf
|
@ -11,9 +11,4 @@ class ComprasController
|
||||||
$file = resource_path('csv/exports/total-pedidos.csv');
|
$file = resource_path('csv/exports/total-pedidos.csv');
|
||||||
return response()->download($file);
|
return response()->download($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showLoginForm()
|
|
||||||
{
|
|
||||||
return view('auth/compras_login');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ class Kernel extends HttpKernel
|
||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
\App\Http\Middleware\Compras::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
|
@ -57,7 +58,6 @@ class Kernel extends HttpKernel
|
||||||
protected $routeMiddleware = [
|
protected $routeMiddleware = [
|
||||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
'admin' => \App\Http\Middleware\Admin::class,
|
'admin' => \App\Http\Middleware\Admin::class,
|
||||||
'compras' => \App\Http\Middleware\Compras::class,
|
|
||||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
|
|
|
@ -3,24 +3,21 @@
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Auth;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class Compras
|
class Compras
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param Closure $next
|
* @param \Closure $next
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if (!Auth::check())
|
$user = Auth::user();
|
||||||
return redirect()->route('compras.login');
|
if ($user->is_compras) {
|
||||||
|
|
||||||
if (Auth::user()->is_compras) {
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
} else {
|
} else {
|
||||||
return response('Necesitás ser de comisión compras para hacer esto', 403);
|
return response('Necesitás ser de comisión compras para hacer esto', 403);
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html class="has-background-warning" lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>{{ config('app.name', 'Pedidos del MPS') }}</title>
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
|
|
||||||
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
|
|
||||||
<script src="https://kit.fontawesome.com/9235d1c676.js" crossorigin="anonymous"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<section class="section">
|
|
||||||
<div id="root" class="container">
|
|
||||||
<h1 class="title">
|
|
||||||
Pedidos MPS
|
|
||||||
</h1>
|
|
||||||
<p class="subtitle">
|
|
||||||
Bienvenidx a la sección de compras de la aplicación del <strong>Mercado Popular de Subsistencia</strong>
|
|
||||||
</p>
|
|
||||||
@error('name')
|
|
||||||
<div class="notification is-danger">
|
|
||||||
Contraseña incorrecta, intentalo nuevamente.
|
|
||||||
</div>
|
|
||||||
@enderror
|
|
||||||
<form method="post" action="login">
|
|
||||||
@csrf
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<script src="{{ mix('js/app.js') }}" defer></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -76,8 +76,6 @@ Route::middleware('auth')->group( function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/compras/login', 'ComprasController@showLoginForm')->name('compras.login');
|
Route::middleware(['auth', 'compras'])->group( function() {
|
||||||
|
|
||||||
Route::middleware(['compras'])->group( function() {
|
|
||||||
Route::get('/compras/pedidos', 'ComprasController@pedidos')->name('compras.pedidos');
|
Route::get('/compras/pedidos', 'ComprasController@pedidos')->name('compras.pedidos');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue