yii2-test-1/common/models/News.php

48 lines
824 B
PHP
Raw Permalink Normal View History

2023-05-06 20:40:02 +03:00
<?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',
];
}
}