yii2-netdisk/models/Country.php

50 lines
877 B
PHP
Raw Normal View History

2024-02-09 12:15:09 +08:00
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "country".
*
* @property string $code
* @property string $name
* @property int $population
*/
class Country extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'country';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['code', 'name'], 'required'],
[['population'], 'integer'],
[['code'], 'string', 'max' => 2],
[['name'], 'string', 'max' => 52],
[['code'], 'unique'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'code' => 'Code',
'name' => 'Name',
'population' => 'Population',
];
}
}