Your IP : 216.73.216.79


Current Path : /var/www/html/kpwkm/backend/modules/tender/models/
Upload File :
Current File : /var/www/html/kpwkm/backend/modules/tender/models/Tender.php

<?php

namespace backend\modules\tender\models;

use Yii;
use asinfotrack\yii2\audittrail\behaviors\AuditTrailBehavior;

/**
 * This is the model class for table "tender".
 *
 * @property int $id
 * @property string|null $ref_no
 * @property string|null $title
 * @property string|null $start_dt
 * @property string|null $end_dt
 * @property string|null $file_url
 * @property string|null $created_at
 * @property string|null $created_by
 * @property string|null $updated_at
 * @property string|null $updated_by
 */
class Tender extends \yii\db\ActiveRecord {

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

    public function behaviors() {
        return [
            'audittrail' => [
                'class' => AuditTrailBehavior::className(),
                // some of the optional configurations
                'ignoredAttributes' => ['created_at', 'updated_at'],
//                'consoleUserId' => 1,
//                'attributeOutput' => [
//                    'desktop_id' => function ($value) {
//                        $model = Desktop::findOne($value);
//                        return sprintf('%s %s', $model->manufacturer, $model->device_name);
//                    },
//                    'last_checked' => 'datetime',
//                ],
            ],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['file_url', 'created_at', 'updated_at', 'created_by', 'updated_by', 'result'], 'safe'],
            [['file_url'], 'required', 'on' => 'create'],
            [['ref_no', 'title', 'start_dt', 'end_dt',], 'required', 'message' => '{attribute} tidak boleh kosong'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'ref_no' => 'No. Perolehan',
            'title' => 'Tajuk',
            'start_dt' => 'Tarikh Mula',
            'end_dt' => 'Tarikh Tamat',
            'file_url' => 'Pautan Dokumen',
            'result' => 'Keputusan'
        ];
    }
}