I have two middleware classes set-up in my application to cache the output of my views. Its all working a treat but I wanted to know how would you go about passing a custom variable with the route to the middleware.
My thought process is this, at present I have the middlewares listed in my $routeMiddleware in kernel.php.
However rather than call ->middleware() on each route, I would prefer to activate the middleware for all routes in $middlewareGroups and then just pass a custom "noCache" variable on the routes that I do not want cached. I can then include a check for this in the middleware.
So something like the following.
Route::get('contact-us', ['as' => 'contactUs', 'uses' => 'PagesController@contactUs'])->with('noCache' => true);
Is this a possibility in Laravel(I'm on 5.2).
Thanks.