The controller's entire role in the MVC pattern is to accept input and return responses.
So instead of returning a model directly from controller, you should write a "working" class into which you'll inject whatever you need: the model/any other class useful for you for the required transformation and use that into the controller.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community