accessing model in middleware

I have to handle all post, put/patch requests so that’s why I came up to writing middleware. I have to fixate changes of model instances (on updating - pre-update state of instance and post-update state of instance) and to get the object I have to know instance of which model is participating in proccess. And now question - how can I detect model in middleware ? There are only request and callback objects are aviable

A request is not associated with a model. Therefore, there’s no model to be “detected” in the middleware.

A view can be written to handle all request verbs, you don’t need to do that in middleware.

Thank you for answer, Ken Whitesell!
your answer is that there is no way to figure out model in middleware, is’nt it? and what do you mean about “request verbs”?

That’s a slight misstatement of what I said.
It’s not that there’s no way to figure it out - it’s that there is no association between a bare request and any model.

There is no model in a request.

Any association of a request with a model is done within the view.