Answer the question
In order to leave comments, you need to log in
How to properly ensure the interaction of the model-controller?
If there is an error in the model, I return
$this
->request
->http_code(403)
->error(1, $message)
->html();
This is true if I request a model from a controller that returns a layout page.
If I request the model via ajax request and there is an error, everything will fall down.
Accordingly, if I return ->json() - if I issue the layout - everything will fall again.
It is clear that you can write a crutch in request - if $type = "html", but how to do it correctly?
Does this mean that the model should always return an array() and all errors are handled only in the controllers?
Or is there a smarter way?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question