<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Announcement extends Model
{
    protected $fillable = [
        'created_by', 'title', 'body', 'is_active', 'pinned', 'expires_at'
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'pinned' => 'boolean',
        'expires_at' => 'date',
    ];

    public function creator()
    {
        return $this->belongsTo(User::class, 'created_by');
    }
}
