redirect page from model

hey, can I redirect page from model.

here is my condition

if ($test) {


} else {



I want to redirect the page from model not controller. is that possible?

I think it has no sense. In any case, $this refers to model, instead of controller, and redirect is a controller’s method not model’s one.

What do you wanna do in specific?

You should never do this in a model, as this breaks the basic MVC principles. Nevertheless it’s possible:



Mike is right, better avoid to do it in the model.

Is better to do a function test in the model, then check this function in the controller and redirect.