la_back/common/models/Table.php

63 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2023-11-21 19:51:44 +03:00
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "table".
*
* @property int $id
* @property string|null $name
* @property int|null $places
* @property string|null $type
* @property string|null $slug
*
* @property Order[] $orders
*/
class Table extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'table';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['places'], 'integer'],
[['name', 'type', 'slug'], 'string', 'max' => 255],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Name',
'places' => 'Places',
'type' => 'Type',
'slug' => 'Slug',
];
}
/**
* Gets query for [[Orders]].
*
* @return \yii\db\ActiveQuery
*/
public function getOrders()
{
return $this->hasMany(Order::class, ['table_id' => 'id']);
}
}