<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Enquiry extends Model {
protected $fillable = ['name','phone','email','subject','message','buyer_type','company_name','city_district','product_interest','monthly_quantity','heard_from','source_page','language','read_at','replied_at'];
protected $casts = ['read_at' => 'datetime', 'replied_at' => 'datetime'];
public function scopeUnread($q) { return $q->whereNull('read_at'); }
public function markAsRead(): void { $this->update(['read_at' => now()]); }
}