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

class Testimonial extends Model
{
    protected $fillable = ['name','location','rating','review','source','review_date','avatar','is_active','sort_order'];
    protected $casts = ['review_date' => 'date'];
    public function scopeActive($query) { return $query->where('is_active', true)->orderBy('sort_order'); }
    public function getStarsHtmlAttribute() {
        return str_repeat('<i class="fas fa-star text-warning"></i>', $this->rating)
             . str_repeat('<i class="far fa-star text-warning"></i>', 5 - $this->rating);
    }
}

class Gallery extends Model
{
    protected $fillable = ['title','image','category','sort_order','is_active'];
    public function scopeActive($query) { return $query->where('is_active', true)->orderBy('sort_order'); }
}

class Enquiry extends Model
{
    protected $fillable = ['name','email','phone','service','message','status'];
}

class Faq extends Model
{
    protected $fillable = ['question','answer','sort_order','is_active'];
    public function scopeActive($query) { return $query->where('is_active', true)->orderBy('sort_order'); }
}
