Gallery.php 1.31 KB
<?php

namespace common\models;

use Yii;
use common\models;

/**
 * This is the model class for table "{{%gallery}}".
 *
 * @property integer $id
 * @property string $translit
 * @property string $title
 * @property string $image
 * @property string $date
 * @property string $gallery
 */

class Gallery extends GalleryRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%gallery}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['translit', 'title', 'image', 'gallery'], 'required'],
            [['gallery'], 'string'],
            [['translit','date'], 'string', 'max' => 100],
            [['title','image'], 'string', 'max' => 250],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'translit' => 'Translit',
            'title' => 'Title',
            'image' => 'Image',
            'gallery' => 'Gallery',
        ];
    }
    public function behaviors()
    {
        return [
            'slug' => [
                'class' => 'common\behaviors\Slug',
                'in_attribute' => 'title',
                'out_attribute' => 'translit',
                'translit' => true
            ]
        ];
    }
}