notification
This commit is contained in:
53
kernel/app_modules/tgbot/models/TgbotNotification.php
Normal file
53
kernel/app_modules/tgbot/models/TgbotNotification.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\app_modules\tgbot\models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property integer $id
|
||||
* @property integer $bot_id
|
||||
* @property integer $dialog_id
|
||||
* @property string $to_group
|
||||
* @property string $content
|
||||
* @property string $photo
|
||||
* @property integer $status
|
||||
*/
|
||||
class TgbotNotification extends Model
|
||||
{
|
||||
|
||||
const DISABLE_STATUS = 0;
|
||||
const NEW_STATUS = 1;
|
||||
const TO_SEND_STATUS = 2;
|
||||
const SENT_STATUS = 3;
|
||||
|
||||
protected $table = 'tgbot_notification';
|
||||
|
||||
protected $fillable = ['bot_id', 'dialog_id', 'to_group', 'content', 'photo', 'status'];
|
||||
|
||||
public static function labels(): array
|
||||
{
|
||||
return [
|
||||
'bot_id' => 'Bot ID',
|
||||
'dialog_id' => 'Dialog ID',
|
||||
'to_group' => 'Group',
|
||||
'content' => 'Контент',
|
||||
'photo' => 'Фото',
|
||||
'status' => 'Статус',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getStatus(): array
|
||||
{
|
||||
return [
|
||||
self::DISABLE_STATUS => "Не активный",
|
||||
self::NEW_STATUS => "Новое",
|
||||
self::TO_SEND_STATUS => "На отправку",
|
||||
self::SENT_STATUS => "Отправлено",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\app_modules\tgbot\models\forms;
|
||||
|
||||
use kernel\FormModel;
|
||||
|
||||
/**
|
||||
* @property int $bot_id
|
||||
* @property int $dialog_id
|
||||
* @property string $to_group
|
||||
* @property string $content
|
||||
* @property string $photo
|
||||
* @property int $status
|
||||
*/
|
||||
class CreateTgbotNotificationForm extends FormModel
|
||||
{
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'bot_id' => 'required|alpha-numeric',
|
||||
'dialog_id' => 'alpha-numeric',
|
||||
'to_group' => 'alpha-numeric',
|
||||
'content' => 'min-str-len:5',
|
||||
'photo' => 'min-str-len:5',
|
||||
'status' => 'alpha-numeric'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user