<?php

namespace Kylin\Community\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

/**
 * 社区通知
 */
class Notice extends Model
{
    protected $fillable = [
        'title',
        'content',
        'type',
        'is_top',
        'publish_at',
        'status',
    ];

    protected function casts(): array
    {
        return [
            'is_top' => 'boolean',
            'publish_at' => 'datetime',
        ];
    }

    public function readLogs(): HasMany
    {
        return $this->hasMany(NoticeReadLog::class);
    }
}
