Route middleware
composer require langsys/laravel-access-guard Route::get('/projects/{project}', [ProjectController::class, 'show']) ->middleware('access-guard:view_projects,project');The first argument is the permission; the optional second names the route parameter holding the entity (otherwise the first route-bound GuardableResource is used). Denial throws UnauthorizedException (403) — see Exceptions.