19 lines
283 B
PHP
19 lines
283 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Middleware;
|
||
|
|
||
|
use Closure;
|
||
|
|
||
|
class AtleastRole
|
||
|
{
|
||
|
|
||
|
public function handle($request, Closure $next, $role)
|
||
|
{
|
||
|
if (!auth()->user()->atleast($role)) {
|
||
|
return redirect()->route('home');
|
||
|
}
|
||
|
return $next($request);
|
||
|
}
|
||
|
|
||
|
}
|