Commit dfd901d0 by jhon

Athentikasu User

parent b3b7a127
...@@ -52,5 +52,9 @@ class Kernel extends HttpKernel ...@@ -52,5 +52,9 @@ class Kernel extends HttpKernel
'can' => \Illuminate\Auth\Middleware\Authorize::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'admin' => \App\Http\Middleware\IsAdmin::class,
'customer' => \App\Http\Middleware\IsCustomer::class,
'kasir' => \App\Http\Middleware\IsKasir::class,
'inventori' => \App\Http\Middleware\IsInventori::class,
]; ];
} }
<?php
namespace App\Http\Middleware;
use Closure;
class IsAdmin
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (auth()->check() && $request->user()->status=='admin'){
return $next($request);
}
return redirect()->guest('/');
}
}
<?php
namespace App\Http\Middleware;
use Closure;
class IsCustomer
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (auth()->check() && $request->user()->status=='customer'){
return $next($request);
}
return redirect()->guest('/');
}
}
<?php
namespace App\Http\Middleware;
use Closure;
class IsInventori
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (auth()->check() && $request->user()->status=='inventori'){
return $next($request);
}
return redirect()->guest('/');
}
}
<?php
namespace App\Http\Middleware;
use Closure;
class IsKasir
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (auth()->check() && $request->user()->status=='kasir'){
return $next($request);
}
return redirect()->guest('/');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment