<?php
declare (strict_types = 1);

namespace app\index\model;

use app\common\model\ArticleLeaveMessageBaseModel;
use think\model\concern\SoftDelete;

/**
 * 文章留言模型
 * @mixin \think\Model
 */
class ArticleLeaveMessageModel extends ArticleLeaveMessageBaseModel
{
    // 启用软删除
    use SoftDelete;
    // 软删除字段
    protected $deleteTime = 'deleted_at';

    // 文章文章范围查询
    public function scopeArticle($query, $article_id)
    {
        $query->where('article_id', '=', $article_id);
    }

    // 审核状态范围查询
    public function scopeAudited($query, bool $is_audited = true)
    {
        $query->where('is_audited', '=', (int)$is_audited);
    }
}
