Skip to content

Instantly share code, notes, and snippets.

@jmas
Created January 15, 2014 11:36
Show Gist options
  • Save jmas/8434704 to your computer and use it in GitHub Desktop.
Save jmas/8434704 to your computer and use it in GitHub Desktop.
function editAction($id) {
$model = App::instance()->models->findById($id);
$request = App::instance()->request;
if ($request->isPost()) {
$model->setAttrs($request->getPost('data'));
if ($model->save()) {
App::instance()->flash->set('success', 'Success!');
App::instance()->redirect(array('controller'=>'user','action'=>'edit','id'=>$id));
}
}
echo $this->render('edit', array(
'model'=>$model,
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment