[streams-platform] - How to set middleware on controller from addon service provider?
Created 7 years ago by lckamalI have setup a middleware and added it to module service provider like this:
protected $middleware = [
\Skrollx\JobsModule\Http\Middleware\CheckPackage::class,
];
But this middleware applies to all controller in this module. How to set middleware to use on a single controller?
ryanthompson
—
7 years ago
@lckamal yes you can - you can also add middleware in the addon service providers / via routes by defining 'middleware' parameter:
https://github.com/anomalylabs/streams-platform/blob/master/src/Addon/AddonProvider.php#L332
https://github.com/anomalylabs/streams-platform/blob/master/src/Addon/AddonProvider.php#L553
Try setting it in your controllers construct function