Skip to content

Instantly share code, notes, and snippets.

@42milez
Last active August 29, 2015 14:27
Show Gist options
  • Save 42milez/dfde9eca7a7000eea437 to your computer and use it in GitHub Desktop.
Save 42milez/dfde9eca7a7000eea437 to your computer and use it in GitHub Desktop.
<?php
/* Aug. 21, 2015 - Akihiro TAKASE
*
* 本ファイルには User テーブルに対応するモデルの定義が含まれます。
*
*/
class Model_User extends \Orm\Model {
// プロパティ
protected static $_properties = array(
'id',
'name',
'email',
'hashed_password',
'salt',
're',
);
// バリデーションルール
public static function validate($factory) {
$val = Validation::forge($factory);
$val->add_field('name', 'Name', 'required|max_length[50]');
$val->add_field('email', 'Email', 'required|max_length[255]|valid_email');
$val->add_field('password', 'Password', 'required|max_length[60]');
return $val;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment