19235aca
Timur Kastemirov
mailing and phone...
|
1
|
<?php
|
735ae87f
Timur Kastemirov
sending email
|
2
|
|
19235aca
Timur Kastemirov
mailing and phone...
|
3
4
|
namespace frontend\models;
|
735ae87f
Timur Kastemirov
sending email
|
5
|
use Yii;
|
19235aca
Timur Kastemirov
mailing and phone...
|
6
7
8
9
10
|
/**
* Created by PhpStorm.
* User: timur
* Date: 09.11.17
* Time: 14:50
|
735ae87f
Timur Kastemirov
sending email
|
11
12
13
14
15
|
*
* @property string $date
* @property string $service
* @property string $time
*
|
19235aca
Timur Kastemirov
mailing and phone...
|
16
|
*/
|
19235aca
Timur Kastemirov
mailing and phone...
|
17
18
19
20
21
22
23
24
25
26
|
class Feedback extends \artbox\core\models\Feedback
{
const SCENARIO_WRITE_US = "write_us";
const SCENARIO_APPOINTMENT = "appointment";
public function scenarios()
{
$scenarios = array_merge(
parent::scenarios(),
[
|
735ae87f
Timur Kastemirov
sending email
|
27
|
self::SCENARIO_APPOINTMENT => [
|
19235aca
Timur Kastemirov
mailing and phone...
|
28
29
30
31
32
|
'name',
'phone',
'date',
'time',
'service',
|
19235aca
Timur Kastemirov
mailing and phone...
|
33
34
35
36
37
38
39
|
],
self::SCENARIO_WRITE_US => [
'name',
'email',
'phone',
'message',
|
735ae87f
Timur Kastemirov
sending email
|
40
|
],
|
19235aca
Timur Kastemirov
mailing and phone...
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
]
);
return $scenarios;
}
public function rules()
{
return [
[
[
'name',
'phone',
'date',
|
19235aca
Timur Kastemirov
mailing and phone...
|
55
56
57
58
59
60
61
62
63
|
],
'required',
'on' => self::SCENARIO_APPOINTMENT,
],
[
[
'name',
'email',
'phone',
|
19235aca
Timur Kastemirov
mailing and phone...
|
64
65
66
67
68
69
70
71
72
73
74
75
|
],
'required',
'on' => self::SCENARIO_WRITE_US,
],
[
[ 'email' ],
'email',
],
[
[
'name',
'date',
|
735ae87f
Timur Kastemirov
sending email
|
76
77
|
'service',
'time',
|
19235aca
Timur Kastemirov
mailing and phone...
|
78
79
|
],
'string',
|
735ae87f
Timur Kastemirov
sending email
|
80
|
'max' => 55,
|
19235aca
Timur Kastemirov
mailing and phone...
|
81
82
|
],
[
|
735ae87f
Timur Kastemirov
sending email
|
83
84
85
|
[ 'phone' ],
'match',
'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/',
|
19235aca
Timur Kastemirov
mailing and phone...
|
86
87
88
89
90
91
92
93
94
95
96
97
|
],
[
[ 'message' ],
'string',
],
[
[ 'status', ],
'boolean',
],
];
}
|
735ae87f
Timur Kastemirov
sending email
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('core', 'id'),
'name' => Yii::t('core', 'name'),
'phone' => Yii::t('core', 'phone'),
'created_at' => Yii::t('core', 'created_at'),
'ip' => Yii::t('core', 'ip'),
'url' => Yii::t('core', 'url'),
'status' => Yii::t('core', 'status'),
'message' => Yii::t('core', 'message'),
'email' => Yii::t('core', 'email'),
'service' => Yii::t('core', 'service'),
'date' => Yii::t('core', 'date'),
];
}
|
19235aca
Timur Kastemirov
mailing and phone...
|
118
|
}
|