diff options
author | emkael <emkael@tlen.pl> | 2016-10-25 16:08:14 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-10-25 18:55:16 +0200 |
commit | 95e5a74b0663e9110ea638dd5d809e9fd1541fa9 (patch) | |
tree | 7407564370f21e4f6923e2ad615fa01e52ff7b92 /app/frontend/model | |
parent | 6edff35cd3315df12c0b41986eadbf29de8a67b2 (diff) |
* model for user auth cookies
Diffstat (limited to 'app/frontend/model')
-rw-r--r-- | app/frontend/model/User.php | 3 | ||||
-rw-r--r-- | app/frontend/model/UserAuthKey.php | 33 |
2 files changed, 35 insertions, 1 deletions
diff --git a/app/frontend/model/User.php b/app/frontend/model/User.php index 5a20582..043269a 100644 --- a/app/frontend/model/User.php +++ b/app/frontend/model/User.php @@ -28,7 +28,8 @@ class User extends ActiveRecord { ]; public static $RELATIONS = [ - 'Calendars' => [self::MANY_TO_MANY, 'Calendar', 'user_selections'] + 'Calendars' => [self::MANY_TO_MANY, 'Calendar', 'user_selections'], + 'AuthKeys' => [self::HAS_MANY, 'UserAuthKey', '_user'] ]; public static function finder($className=__CLASS__) { diff --git a/app/frontend/model/UserAuthKey.php b/app/frontend/model/UserAuthKey.php new file mode 100644 index 0000000..64d9e65 --- /dev/null +++ b/app/frontend/model/UserAuthKey.php @@ -0,0 +1,33 @@ +<?php + +Prado::using('Application.db.ActiveRecord'); +Prado::using('Application.model.User'); + +class UserAuthKey extends ActiveRecord { + + const TABLE = 'user_auth_keys'; + + public $ID; + public $AuthKey; + public $IPAddress; + + public $UserID; + + public static $COLUMN_MAPPING = [ + 'id' => 'ID', + 'auth_key' => 'AuthKey', + 'ip_address' => 'IPAddress', + '_user' => 'UserID' + ]; + + public static $RELATIONS = [ + 'User' => [self::BELONGS_TO, 'User', '_user'] + ]; + + public static function finder($className=__CLASS__) { + return parent::finder($className); + } + +} + +?> |