User.php
918 Bytes
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
<?php
namespace App\Model;
use Phalcon\Mvc\Model\Validator\Email as EmailValidator;
class User extends \App\Mvc\DateTrackingModel
{
public $id;
public $name;
public $pass;
public $email;
public $role;
public function getSource()
{
return 'user';
}
public function columnMap()
{
return parent::columnMap() + [
'id' => 'id',
'name' => 'name',
'pass' => 'pass',
'email' => 'email',
'role' => 'role'
];
}
public function validation()
{
$validator = new Validation();
$validator->add(
'email',
new EmailValidator(
[
'model' => $this,
'message' => 'Please enter a correct email address',
]
)
);
return $this->validate($validator);
}
}