<?php

namespace nota\models;

use Yii;

/**
 * This is the model class for table "m_sekolah".
 *
 * @property int $iId
 * @property string $vNama
 * @property string $noSK
 * @property string $vLogo
 * @property string|null $vTelp
 * @property string $vEmail
 * @property string $vAlamat
 * @property string $vKota
 * @property string $slug
 * @property string|null $eDeleted
 * @property int|null $iCreatedid
 * @property string $tCreated
 * @property int|null $iUpdatedid
 * @property string $tUpdated
 */
class Cluster extends \yii\db\ActiveRecord
{
	public static function getDb() {
        return Yii::$app->get('dbnota'); 
    }
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'm_cluster';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
{
    return [
        [['vNama', 'noSK', 'vEmail', 'vAlamat', 'vKota', 'slug'], 'required'],
        [['vAlamat', 'eDeleted','vMisiVisi','idCluster','vLokasi','prefix'], 'string'],
        [['iCreatedid', 'iUpdatedid','vIPL','panjang_nomor','format_id','print_id','pdf_id'], 'integer'],
        [['tCreated', 'tUpdated'], 'safe'],
        [['vNama', 'noSK', 'vLogo', 'vImage', 'vEmail', 'slug'], 'string', 'max' => 100],
        [['vTelp', 'vKota','vProvinsi'], 'string', 'max' => 50],
    ];
}


    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'iId' => 'ID',
            'vNama' => 'Nama',
            'idCluster' => 'Kode Perumahan',
            'noSK' => 'No. Rekening, BANK IPL Perumahan',
            'vIPL' => 'Nilai IPL perbulan',
            'vLogo' => 'Logo',
            'vTelp' => 'No. Telp',
            'vLokasi'=>'Lokasi',
            'vEmail' => 'Email',
            'vAlamat' => 'Alamat',
            'vMisiVisi' => 'Tentang Sekolah',
            'vKota' => 'Kota',
            'vProvinsi'=>'Provinsi',
            'slug' => 'Slug',
            'eDeleted' => 'Deleted',
            'iCreatedid' => 'Createdid',
            'tCreated' => 'Created',
            'iUpdatedid' => 'Updatedid',
            'tUpdated' => 'Updated',
        ];
    }

    public function getFormat()
    {
        return $this->hasOne(SettingFormatNomor::class, ['id' => 'format_id']);
    }

}
