add_holidays

This commit is contained in:
SoHardKI
2019-07-16 11:58:05 +03:00
parent 3af5bcab71
commit e961c3f35f
15 changed files with 491 additions and 0 deletions

53
common/models/Holiday.php Normal file
View File

@ -0,0 +1,53 @@
<?php
namespace common\models;
use yii\db\ActiveRecord;
/**
*@property int $id
*@property int $card_id
* @property int $dt_start
* @property int $dt_end
*/
class Holiday extends ActiveRecord
{
public function init()
{
parent::init(); // TODO: Change the autogenerated stub
}
public static function tableName()
{
return 'holiday'; // TODO: Change the autogenerated stub
}
public function rules()
{
return [
[['card_id', 'dt_start', 'dt_end'], 'integer'],
// [['card_id', 'dt_start', 'dt_end'], 'required'],
];
}
public function attributeLabels()
{
return [
'card_id' => 'ID пользователя',
'dt_start' => 'Дата начала отпуска',
'dt_end' => 'Дата конца отпуска'
];
}
public function afterFind()
{
parent::afterFind(); // TODO: Change the autogenerated stub
$this->dt_start = date('d-m-Y', $this->dt_start);
$this->dt_end = date('d-m-Y', $this->dt_end);
}
public function getUsers()
{
return $this->hasOne(UserCard::className(),['id' => 'card_id']);
}
}