1
0
Fork 0
mirror of https://github.com/janickiy/yii2-nomer synced 2025-02-12 18:11:52 +00:00
yii2-nomer/models/Notification.php

60 lines
1.2 KiB
PHP
Raw Normal View History

2020-02-05 03:34:26 +00:00
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "notifications".
*
* @property integer $id
* @property mixed tm_send
* @property mixed tm_create
* @property mixed payload
* @property mixed message
*/
class Notification extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'notifications';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['message', 'payload', 'tm_create', 'tm_send'], 'safe']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'message' => 'Сообщение',
'payload' => 'payload',
'tm_create' => 'Дата создания',
'tm_send' => 'Дата отправки'
];
}
public function getResults()
{
return $this->hasMany(NotificationResult::className(), ["notify_id" => "id"]);
}
public function getGoodResults()
{
return $this->hasMany(NotificationResult::className(), ["notify_id" => "id"])->where(["status" => 200]);
}
}