How to redirect (Phalcon\Http\Response) from static method in model

I'm trying to create a reusable static function which redirects if true. This function will be in a model.

    public static function checkEmtpy(ResultsetInterface $resultset)
        $di = \Phalcon\DI::getDefault();

        if (empty($resultset->toArray())) {

            $di->get('flash')->error('Page not found.');
            return $di->get('response')->redirect('content');

        } else {

            return false;


I tried several ways to redirect but I can't get it to redirect from the model.

What can I change to make this work or isn't this possible at all?

Model shouldn't really do stuff like this. What you mean you can't get it working? Redirect is pretty straight forward, it just uses Location internally, this code should work, what exactly happens for you?

Yeah - the model should report the state back to the controller, which then handles the redirecting. In the controller, you can then just go $this->response->redirect(...)