<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class QuizSettingsProvider extends ServiceProvider
{
    /**
     * Register services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap services.
     */
    public function boot(): void
    {
        try {

            $coins = getOptionWithJsonDecode('coin_settings', config('application_info.coins'));
            if ($coins) {
                config()->set('application_info.coins', $coins);
            }

            $quiz_ranking_levels = getOptionWithJsonDecode('quiz_ranking_levels', config('application_info.quiz_ranking_levels'));
            if ($quiz_ranking_levels) {
                config()->set('application_info.quiz_ranking_levels', $quiz_ranking_levels);
            }

        } catch (\Throwable $th) {
        }
    }
}
