<?php

namespace AleshaCMS\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class CanAccessAdmin
{
    public function handle(Request $request, Closure $next)
    {
        if (!auth()->check() || !auth()->user()->canAccessAdmin()) {
            abort(403);
        }

        return $next($request);
    }
}
