/
peyli
/
Practice
Обзор
Документация
Войти
/
peyli
/
Practice
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
models/Type.php
63 строки
1 KB
Катя
Полный код
27 июн 2026, 14:28
27 июн 2026, 14:28
6181a72
Код
Авторство
О чём код?
<?php namespace app\models; use Yii; /** * This is the model class for table "type". * * @property int $id * @property string $name * @property string|null $created_at * * @property Event[] $events */ class Type extends \yii\db\ActiveRecord { /** * {@inheritdoc} */ public static function tableName() { return 'type'; } /** * {@inheritdoc} */ public function rules() { return [ [['name'], 'required'], [['created_at'], 'safe'], [['name'], 'string', 'max' => 255], [['name'], 'unique'], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'name' => 'Name', 'created_at' => 'Created At', ]; } /** * Gets query for [[Events]]. * * @return \yii\db\ActiveQuery */ public function getEvents() { return $this->hasMany(Event::class, ['event_type' => 'name']); } }