Your IP : 216.73.216.79


Current Path : /var/www/html/dosm/backend/modules/contentSlider/models/
Upload File :
Current File : /var/www/html/dosm/backend/modules/contentSlider/models/ContentSliderBackground.php

<?php

namespace backend\modules\contentSlider\models;

use Yii;
use yii\behaviors\TimestampBehavior;
use yii\behaviors\BlameableBehavior;
use yii\db\Expression;
use yii\db\ActiveRecord;
use asinfotrack\yii2\audittrail\behaviors\AuditTrailBehavior;

/**
 * This is the model class for table "content_slider_background".
 *
 * @property int $background_id
 * @property string|null $background_portal
 * @property string|null $background_url
 * @property string|null $background_status
 * @property string|null $background_start_date
 * @property string|null $background_start_time
 * @property string|null $background_end_date
 * @property string|null $background_end_time
 */
class ContentSliderBackground extends \yii\db\ActiveRecord {

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

    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 [
            [['background_status'], 'required'],
            [['background_url'], 'required', 'on' => 'create'],
            [['background_portal', 'background_url', 'background_status', 'background_start_date', 'background_start_time', 'background_end_date', 'background_end_time'], 'safe'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'background_id' => 'Background ID',
            'background_portal' => 'Portal',
            'background_url' => 'Upload Image',
            'background_status' => 'Status',
            'background_start_date' => 'Publish Start Date',
            'background_start_time' => 'Publish Start Time',
            'background_end_date' => 'Publish End Date',
            'background_end_time' => 'Publish End Time',
        ];
    }

}