Current Path : /home/vmanager/www/common/models/ |
Linux 9dbcd5f6333d 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 |
Current File : /home/vmanager/www/common/models/Notifications.php |
<?php namespace common\models; use Yii; use yii\mongodb\ActiveRecord; use yii\behaviors\TimestampBehavior; use common\models\types\NotificationType; /** * This is the model class for collection "notifications". * * @property \MongoDB\BSON\ObjectId $_id * @property string $title * @property string $content * @property integer $id_user * @property integer $id_item * @property string $type * @property integer $status * @property \MongoDB\BSON\UTCDateTime $created_at */ class Notifications extends ActiveRecord { /** * @inheritdoc */ public static function collectionName() { return 'notifications'; } /** * @inheritdoc */ public function behaviors() { return [ [ 'class' => TimestampBehavior::className(), 'value' => new \MongoDB\BSON\UTCDateTime(), 'updatedAtAttribute' => false, ] ]; } /** * @inheritdoc */ public function attributes() { return ['_id', 'title', 'content', 'id_user', 'id_item', 'type', 'status', 'created_at']; } /** * @inheritdoc */ public function rules() { return [ ['title', 'required'], ['title', 'string'], ['content', 'required'], ['content', 'string'], ['id_user', 'required'], ['id_user', 'number', 'integerOnly' => true, 'min' => 1], ['id_user', 'exist', 'targetClass' => Users::className(), 'targetAttribute' => 'id_user'], ['id_item', 'default'], ['type', 'required'], ['type', 'in', 'range' => NotificationType::$values], ['status', 'default', 'value' => 0], ['status', 'required'], ['status', 'number', 'integerOnly' => true, 'min' => 0, 'max' => 1], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ '_id' => Yii::t('common-models', 'ID'), 'title' => Yii::t('common-models', 'Tytuł'), 'content' => Yii::t('common-models', 'Treść'), 'id_user' => Yii::t('common-models', 'ID użytkownika'), 'id_item' => Yii::t('common-models', 'ID elementu'), 'type' => Yii::t('common-models', 'Typ'), 'status' => Yii::t('common-models', 'Status'), 'created_at' => Yii::t('common-models', 'Data utworzenia'), ]; } }