<?php

use App\Models\Language;
use Illuminate\Support\Facades\App;

if (!function_exists('setAppLocale')) {
    function setAppLocale()
    {
        // Cari bahasa yang status on
        $lang = Language::where('status', 'on')->first();

        // Default fallback ke Indonesia
        $locale = $lang ? $lang->code : 'id';

        App::setLocale($locale);
    }
}
