ndequeker
ndequeker

Reputation: 7990

Kohana redirect

After a form-submit in Kohana, I want the user to go back to the homepage. Is it correct to use a redirect for this?

public function action_edit($id)
{
    if (!empty($post))
    {
        if ($post->validate())
        {
            $this->request->redirect(Route::get('admin')->uri(array('action' => 'list')));

        }
    }
}

Thanks in advance!

Upvotes: 1

Views: 6811

Answers (2)

biakaveron
biakaveron

Reputation: 5483

Sometimes $this->request->uri($params) (instead of Route::get()->uri()) maybe useful. For example, when you want to use current controller (redirect to another action) or the same route. It will use route params from current request by default.

Upvotes: 1

SpadXIII
SpadXIII

Reputation: 916

The redirecting part is indeed correct. The validation part is missing a few lines.

Upvotes: 0

Related Questions