Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Created March 12, 2009 13:05
Show Gist options
  • Save shadowhand/78049 to your computer and use it in GitHub Desktop.
Save shadowhand/78049 to your computer and use it in GitHub Desktop.
<?php
public function create()
{
$this->template->content = View::factory('admin/users/edit')
->bind('roles', $roles)
->bind('post', $post)
->bind('errors', $errors)
->bind('cancel', $return)
->bind('delete', $delete);
// Set return URL
$return = Router::uri('admin', array('controller' => 'users'));
// Do not overwrite POST
$post = $_POST;
// Load a new user
$user = ORM::factory('user');
// Validate the user
$user->validate($post, $return);
// Load roles
$roles = ORM::factory('role')->find_all();
// Load errors
$errors = $post->errors('forms.user');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment