Your IP : 216.73.216.79


Current Path : /var/www/html/project/models/
Upload File :
Current File : /var/www/html/project/models/ParamCat.php

<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "param_cat".
 *
 * @property int $id
 * @property string $name
 * @property string $desc
 * @property string $created_dt
 * @property int $created_by
 * @property string $updated_dt
 * @property int $updated_by
 */
class ParamCat extends \yii\db\ActiveRecord {

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return 'param_cat';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['name', 'desc', 'uuid'], 'required'],
            [['desc'], 'string'],
            [['created_dt', 'updated_dt'], 'safe'],
            [['created_by', 'updated_by'], 'integer'],
            [['name'], 'string', 'max' => 255],
            [['uuid'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'name' => 'Category Name',
            'desc' => 'Description',
            'created_dt' => 'Created Dt',
            'created_by' => 'Created By',
            'updated_dt' => 'Updated Dt',
            'updated_by' => 'Updated By',
        ];
    }

    public function findID($uuid) {
        $id = 0;
        if (($model = static::findOne(['uuid' => $uuid])) !== null) {
            $id = $model->id;
        }
        return $id;
    }

}