<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class CheckPermission {
    public function handle(Request $request, Closure $next, string $perm) {
        $u = $request->user();
        if (!$u || !$u->canDo($perm)) abort(403, 'You do not have permission: '.$perm);
        return $next($request);
    }
}
