So, for me the main 2 methods of adding middleware are in the routes files, api.php
and web.php
, or alternatively in the constructor of any Controller
class.
However it occurred to me that there might be situations where I want to choose for a certain Request subclass to have some middleware applied to it. I haven't seen documentation for this. Is there a way to define middleware in these custom Requests?
For clarity, I'm referring to the Request classes that get made when you do php artisan make:request