Created
October 2, 2016 12:50
-
-
Save ydatech/bc49cb3cc39ca364ce54d1f6e28212f4 to your computer and use it in GitHub Desktop.
Model Provinsi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace app\models; | |
| use Yii; | |
| /** | |
| * This is the model class for table "provinsi". | |
| * | |
| * @property integer $id | |
| * @property string $nama | |
| * | |
| * @property Kota[] $kotas | |
| */ | |
| class Provinsi extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return 'provinsi'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['nama'], 'string', 'max' => 50], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => 'ID', | |
| 'nama' => 'Nama', | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getKota() | |
| { | |
| return $this->hasMany(Kota::className(), ['provinsi_id' => 'id']); | |
| } | |
| public function extraFields(){ | |
| return ['kota']; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment