lckamal - 11 months ago

I have setup a middleware and added it to module service provider like this:

protected $middleware = [

But this middleware applies to all controller in this module. How to set middleware to use on a single controller?

dominique - 11 months ago

Try setting it in your controllers construct function

public function __construct()

lckamal - 11 months ago

It worked! thanks. can we add parameter like we do in laravel? eg.. middleware('role:editor')

ryanthompson - 11 months ago

@lckamal yes you can - you can also add middleware in the addon service providers / via routes by defining 'middleware' parameter: