<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "holidays".
 *
 * @property string $id
 * @property string $name
 * @property string $date
 */
class Holidays extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'holidays';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['name', 'date'], 'required'],
            [['date'], 'safe'],
            [['name'], 'string', 'max' => 150],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'name' => Yii::t('app', 'Name'),
            'date' => Yii::t('app', 'Date'),
        ];
    }

    public static function getHolidaysArray(){
        $holidays_array = [];
        $holidays = Holidays::find()->all();
        foreach($holidays as $holiday){
            $holidays_array[] = $holiday->date; 
        }
        return $holidays_array;
    }
}
