-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.php
More file actions
84 lines (78 loc) · 2.24 KB
/
Client.php
File metadata and controls
84 lines (78 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
namespace app\models;
use Yii;
use borales\extensions\phoneInput\PhoneInputValidator;
/**
* This is the model class for table "client".
*
* @property int $id
* @property string $firstName
* @property string $lastName
* @property string $email
* @property string $phoneNumber
* @property bool $active
* @property int $created_by
* @property string $created_time
* @property int|null $modified_by
* @property string|null $modified_time
*/
class Client extends \app\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'client';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['firstName', 'lastName', 'email', 'phoneNumber'], 'required'],
[['active'], 'boolean'],
[['active'], 'default', 'value' => true],
[['created_by', 'modified_by'], 'default', 'value' => null],
[['created_by', 'modified_by'], 'integer'],
[['created_time', 'modified_time'], 'safe'],
[['firstName', 'lastName'], 'string', 'max' => 32],
[['email', 'phoneNumber'], 'string', 'max' => 255],
[['email'], 'unique'],
[['phoneNumber'], PhoneInputValidator::className()],
[['firstName', 'lastName'], 'unique', 'targetAttribute' => ['firstName', 'lastName']],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => Yii::t('app', 'ID'),
'firstName' => Yii::t('app', 'First Name'),
'lastName' => Yii::t('app', 'Last Name'),
'email' => Yii::t('app', 'Email'),
'phoneNumber' => Yii::t('app', 'Phone Number'),
'active' => Yii::t('app', 'Active'),
'created_by' => Yii::t('app', 'Created By'),
'created_time' => Yii::t('app', 'Created Time'),
'modified_by' => Yii::t('app', 'Modified By'),
'modified_time' => Yii::t('app', 'Modified Time'),
];
}
/**
* {@inheritdoc}
*/
public function fields()
{
return [
'id',
'firstName',
'lastName',
'email',
'phoneNumber',
];
}
}