1
0
Fork 0
mirror of https://github.com/Oreolek/kangana.git synced 2024-07-08 01:24:23 +03:00
kangana/application/classes/Model/Client.php

50 lines
969 B
PHP
Raw Normal View History

2014-01-17 13:39:34 +02:00
<?php defined('SYSPATH') OR die('No direct access allowed.');
2014-01-18 08:03:47 +02:00
/**
* Client model.
* Client is just a subscriber at the moment.
* @package Models
* @author Oreolek
**/
2014-01-17 13:39:34 +02:00
class Model_Client extends ORM {
2014-01-28 09:50:18 +02:00
protected $_has_many = array(
'subscription' => array(
'model' => 'Subscription',
'through' => 'clients_subscriptions'
)
2014-01-18 08:03:47 +02:00
);
/**
* @return array validation rules
**/
public function rules()
{
return array(
'email' => array(
array('not_empty'),
array('email'),
array('min_length', array(':value', 5)),
),
'name' => array(
array('not_empty'),
array('min_length', array(':value', 5)),
),
);
}
/**
* Array of field labels.
* Used in forms.
**/
protected $_labels = array(
'email' => 'Email',
'name' => 'Name',
'token' => 'Subscription token'
);
2014-01-28 09:50:18 +02:00
public function customize()
{
$this->token = base64_encode(openssl_random_pseudo_bytes(32));
}
2014-01-18 08:03:47 +02:00
2014-01-17 13:39:34 +02:00
}