<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class ContactMessage extends Model
{
    protected $fillable = ['name', 'email', 'subject', 'message', 'type', 'status', 'ip_address', 'replied_at', 'replied_by'];
    protected $casts    = ['replied_at' => 'datetime'];

    public function repliedBy() { return $this->belongsTo(User::class, 'replied_by'); }
    public function scopeUnread($q) { return $q->where('status', 'unread'); }
}
