williamxsp's avatar

Can Middleware

Im trying to use can middleware inside my web.php file and it says that

Class can does not exist

Do I need to register something to get this up and running?

Inside my AppServiceProvider Ive already created the boot method and registered policies and created a gate.

0 likes
2 replies
click's avatar

You posted this in the Lumen category so I suppose you are using Lumen and not the full blown Laravel. Is it possible Lumen does not have this middleware available out of the box?

The can middleware in Laravel is actually the Illuminate\Auth\Middleware\Authorize class. Do you have a can defined in the middleware of your Http\Kernel.php?

I can't figure it out from only the the docs: https://lumen.laravel.com/docs/5.7/authorization but using middleware to check permissions isn't mentioned in the docs of Lumen.

Please or to participate in this conversation.