IsAdmin.php
392 Bytes
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class IsAdmin
{
public function handle(Request $request, Closure $next)
{
if (Auth::user()->is_admin === 1) {
return redirect(RouteServiceProvider::HOME);
}
return $next($request);
}
}