<?php

namespace modules\cors\models;


use Yii;
use yii\behaviors\BlameableBehavior;
use yii\behaviors\TimestampBehavior;
use modules\users\models\User;
/**
 * This is the model class For table "vehiclereminders".
 *
 * @property string $id
 * @property string $created_by
 * @property string $updated_by
 * @property string $deleted_by
 * @property string $actid
 * @property string $relatedid
 * @property string $vehicle
 * @property string $employee
 * @property integer $created_at
 * @property integer $updated_at
 * @property integer $deleted_at
 * @property integer $jobno
 * @property integer $date
 * @property integer $reminderdate
 * @property string $status
 * @property string $padno
 * @property string $frequency
 * @property string $paidedby
 * @property string $type
 * @property string $description
 */
class Vehicleremindersbe extends \common\models\Base {
	
    public $dates = ['created_at', 'updated_at', 'deleted_at', 'reminderdate', 'date'];
	public $uniqueidentifiers = ['employee','relatedid'];
    public $securefields = [];
	public $vehiclesd = [];
	
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'vehiclereminders';
    }

    /**
     * @inheritdoc
     */
    public function rules(): array
    {
        return [
            [['id', 'created_by', 'updated_by', 'deleted_by', 'actid', 'relatedid', 'vehicle', 'employee', 'status', 'padno', 'frequency', 'paidedby', 'type', 'description'], 'string'],
            [['jobno', ], 'integer'],
            [['created_at', 'updated_at', 'deleted_at', 'vehiclesd','reminderdate', 'date'], 'safe'],
            [['id'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels(): array
    {
        return [
            'id' => 'ID',
            'created_by' => 'Created By',
            'updated_by' => 'Updated By',
            'deleted_by' => 'Deleted By',
            'actid' => 'Actid',
            'relatedid' => 'Relatedid',
            'vehicle' => 'Vehicle',
            'employee' => 'Employee',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'deleted_at' => 'Deleted At',
            'jobno' => 'Jobno',
            'date' => 'Date',
            'reminderdate' => 'Reminderdate',
            'status' => 'Status',
            'padno' => 'Padno',
            'frequency' => 'Frequency',
            'paidedby' => 'Paidedby',
            'type' => 'Type',
            'description' => 'Description',
        ];
    }
    
    public function getEmployeel() {
		return $this->hasOne(User::class, ['id' => 'employee']);
	}
    public function getRlookup() {
		return $this->hasMany(\backend\models\Lookuptablebe::class, ['relatedid' => 'id']);
	}
	public function getVehicles() {
		return $this->hasMany(\modules\cors\models\Vehiclebe::class, ['id' => 'sourceid'])
			->via('rlookup');	
	}
}
