spatie/laravel-permission

Documentation has namespace typo.

superuser-me opened this issue · 2 comments

This is my first issue & i'm a beginner and naive, who's learning programming!

On This page,
https://spatie.be/docs/laravel-permission/v5/basic-usage/middleware#content-package-middleware

'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,

when i tried registering package middleware inside kernel file it threw error

Target class [Spatie\Permission\Middleware\RoleMiddleware] does not exist.

i resolved it by replacing it to

'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,

The first set uses Middleware as the namespace, while the second set uses Middlewares.

Changing it to Middlewares solved my issue.

i think docs has this typo so creating this issue!

I'm on
PHP 8.1.24
Laravel 10.28.0

Thanks for pointing it out. Will be releasing v6 this week, so the docs will be back in sync again then!
Apologies for any confusion!