63 lines
1.1 KiB
PHP
63 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace common\models;
|
||
|
|
|
||
|
|
use Yii;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* This is the model class for table "const_province".
|
||
|
|
*
|
||
|
|
* @property integer $id
|
||
|
|
* @property string $name
|
||
|
|
*
|
||
|
|
* @property ConstHospital[] $constHospitals
|
||
|
|
* @property ConstProvinceArea[] $constProvinceAreas
|
||
|
|
*/
|
||
|
|
class ConstProvince extends \yii\db\ActiveRecord
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @inheritdoc
|
||
|
|
*/
|
||
|
|
public static function tableName()
|
||
|
|
{
|
||
|
|
return 'const_province';
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @inheritdoc
|
||
|
|
*/
|
||
|
|
public function rules()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
[['name'], 'string']
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @inheritdoc
|
||
|
|
*/
|
||
|
|
public function attributeLabels()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'id' => 'ID',
|
||
|
|
'name' => 'จังหวัด',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return \yii\db\ActiveQuery
|
||
|
|
*/
|
||
|
|
public function getConstHospitals()
|
||
|
|
{
|
||
|
|
return $this->hasMany(ConstHospital::class, ['province_id' => 'id']);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return \yii\db\ActiveQuery
|
||
|
|
*/
|
||
|
|
public function getConstProvinceAreas()
|
||
|
|
{
|
||
|
|
return $this->hasMany(ConstProvinceArea::class, ['province_id' => 'id']);
|
||
|
|
}
|
||
|
|
}
|