kokjan/common/models/ForumComment.php

81 lines
2.1 KiB
PHP
Raw Normal View History

2026-02-25 06:59:34 +00:00
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "forum_comment".
*
* @property int $id
* @property int $forum_thread_id
* @property string $forum_comment
* @property string $comment_by
* @property int|null $created_at
* @property int|null $updated_at
*/
class ForumComment extends \yii\db\ActiveRecord
{
public $verifyCode;
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'forum_comment';
}
public function behaviors()
{
return [
TimestampBehavior::class
];
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['forum_thread_id', 'forum_comment', 'comment_by'], 'required'],
[['forum_thread_id', 'status','created_at', 'updated_at'], 'integer'],
[['forum_comment'], 'string', 'max' => 500],
[['comment_by'], 'string', 'max' => 200],
[['forum_thread_id', 'forum_comment'], ForbiddenWordsValidator::class, 'forbiddenWords' =>
['สล็อต', 'pg', 'pg-slot', 'slot', 'ศูนย์รวมเกมสล็อต', 'ทดลองเล่นสล็อต', 'รวมเกมแตกง่าาย','เกม','พนัน','ดูหนัง']],
['verifyCode', 'captcha', 'on' => 'comment_new'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'forum_thread_id' => 'หัวข้อกระทู้',
'forum_comment' => 'แสดงความคิดเห็น',
'comment_by' => 'ผู้โพสต์',
'status' => 'สถานะ',
'created_at' => 'เพิ่มเมื่อ',
'updated_at' => 'แก้ไขเมื่อ',
];
}
/**
* Gets query for [[ForumThread]].
*
* @return \yii\db\ActiveQuery
*/
public function getForumThread()
{
return $this->hasOne(ForumThread::className(), ['id' => 'forum_thread_id']);
}
}