-
-
Save RelativeMedia/58510987af3f84678a53 to your computer and use it in GitHub Desktop.
FuelPHP User_Model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Model_User extends \Orm\Model | |
{ | |
protected static $_belongs_to = array( 'provider' ); | |
protected static $_properties = array( | |
'id', | |
'username', | |
'group', | |
'provider_id', | |
'email', | |
'last_login', | |
'created_at', | |
'updated_at', | |
); | |
protected static $_observers = array( | |
'Orm\Observer_CreatedAt' => array( | |
'events' => array('before_insert'), | |
'mysql_timestamp' => false, | |
), | |
'Orm\Observer_UpdatedAt' => array( | |
'events' => array('before_save'), | |
'mysql_timestamp' => false, | |
), | |
); | |
public static function validate($factory){ | |
$val = Validation::forge($factory); | |
$val->add_field('username', 'Username', 'required|max_length[255]'); | |
$val->add_field('password', 'Password', 'required|max_length[255]'); | |
$val->add_field('confirm_password', 'Confirm Password', 'required|match_value[password]|max_length[255]'); | |
$val->add_field('group', 'Group', 'required|valid_string[numeric]'); | |
$val->add_field('email', 'Email', 'required|valid_email|max_length[255]'); | |
return $val; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment