Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
LoginAttempt.php
1 <?php
2 
3 /**
4  *
5  **/
6 class LoginAttempt extends CActiveRecord
7 {
8 
9  /**
10  * Returns the static model of the specified AR class.
11  * @return CActiveRecord the static model class
12  */
13  public static function model($className = __CLASS__)
14  {
15  return parent::model($className);
16  }
17 
18  /**
19  * @return string the associated database table name
20  */
21  public function tableName()
22  {
23  return '{{login_attempts}}';
24  }
25 
26  public function rules()
27  {
28  return array(
29  array('attempts', 'default', 'value' => 1),
30  array('created, updated', 'default', 'value' => AppHelper::mysqlDate()),
31  array('ip, attempts, created, updated', 'required'),
32  array('attempts', 'numerical', 'integerOnly' => true),
33  );
34  }
35 
36  public function init()
37  {
38  $this->onBeforeSave = array($this, 'updateTimestamp');
39  }
40 
41  public function updateTimestamp()
42  {
43  $this->updated = AppHelper::mysqlDate();
44  }
45 
46 }