Plant.php
1.87 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
<?php
namespace app\models;
use Yii;
/**
 * This is the model class for table "{{%plant}}".
 *
 * @property int $id
 * @property string $title
 * @property string $description
 * @property double $height
 * @property int $bush_type
 * @property int $flower_form
 * @property int $flower_tint
 * @property string $created_at
 * @property int $cost
 * @property int $top
 * @property int $active
 * @property string $edit_at
 */
class Plant extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%plant}}';
    }
    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['title'], 'required'],
            [['description'], 'string'],
            [['height'], 'number'],
            [['bush_type', 'flower_form', 'flower_tint', 'cost'], 'integer'],
            [['created_at', 'edit_at'], 'datetime'],
            [['top', 'active'], 'integer', 'max' => 1],
            [['title'], 'string', 'max' => 256],
            [['title'], 'unique'],
            [['title', 'description', 'height', 'bush_type', 'flower_form', 'flower_tint', 'cost', 'top', 'active'], 'safe'],
        ];
    }
    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => 'Название',
            'description' => 'Описание',
            'height' => 'Высота куста',
            'bush_type' => 'Тип куста',
            'flower_form' => 'Форма цветка',
            'flower_tint' => 'Оттенок цветка',
            'created_at' => 'Дата создания',
            'cost' => 'Цена',
            'top' => 'показать в топ',
            'active' => 'Показывать',
            'edit_at' => 'Дата редактирования',
        ];
    }
}