<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SiteSetting extends Model
{
    protected $fillable = ['key', 'label', 'value', 'group', 'type', 'sort_order'];

    public static function asMap(?string $group = null): array
    {
        $q = static::query();
        if ($group) $q->where('group', $group);
        return $q->pluck('value', 'key')->all();
    }
}
