<?php

namespace App\Services;

use App\Models\SiteInfo;

class SiteInfoService
{
    public function get(string $key, $default = null)
    {
        $record = SiteInfo::where('key', $key)->first();

        return $record ? $record->value : $default;
    }

    public function getMany(array $keys): array
    {
        return SiteInfo::whereIn('key', $keys)
            ->pluck('value', 'key')
            ->toArray();
    }
}
