48 lines
824 B
PHP
48 lines
824 B
PHP
|
<?php
|
||
|
|
||
|
namespace common\models;
|
||
|
|
||
|
/**
|
||
|
* This is the model class for table "news".
|
||
|
*
|
||
|
* @property int $id
|
||
|
* @property string|null $title
|
||
|
* @property string|null $text
|
||
|
* @property string|null $slug
|
||
|
*/
|
||
|
class News extends \yii\db\ActiveRecord
|
||
|
{
|
||
|
/**
|
||
|
* {@inheritdoc}
|
||
|
*/
|
||
|
public static function tableName()
|
||
|
{
|
||
|
return 'news';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* {@inheritdoc}
|
||
|
*/
|
||
|
public function rules()
|
||
|
{
|
||
|
return [
|
||
|
[['text'], 'string'],
|
||
|
[['title', 'slug'], 'string', 'max' => 255],
|
||
|
[['slug'], 'unique'],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* {@inheritdoc}
|
||
|
*/
|
||
|
public function attributeLabels()
|
||
|
{
|
||
|
return [
|
||
|
'id' => 'ID',
|
||
|
'title' => 'Title',
|
||
|
'text' => 'Text',
|
||
|
'slug' => 'Slug',
|
||
|
];
|
||
|
}
|
||
|
}
|