Is it good practice/possible to access a model, and do some processing in a middleware's process_request() method?
I am thinking of using middleware to parse out subdomains. These subdomains will represent cities, and I would like to know if the subdomain (or city) exists in our database.
Assuming that I have a City model, can I import it and raise a 404 if the city does not exist?
Is it good practice? Sure. That's what auth
does to add the user to the request.
Can I import it? Sure. Can I raise a 404 if the city doesn't exist? Sure.
Are you just looking for placation?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With