<?php

use App\Models\Setting;

if (! function_exists('setting')) {
    function setting(string $key, $default = null)
    {
        $settings = cache()->rememberForever('settings', function () {
            return Setting::first();
        });

        return $settings?->{$key} ?? $default;
    }
}