<?php

namespace App\Http\Controllers\V1;

use App\Models\BaseConfig;

class BaseConfigController extends Controller
{
    /**
     * UserController constructor.
     */
    public function __construct()
    {
        $this->middleware('check', ['except' => ['index']]);
    }

    /**
     * 获取配置
     * @return \Illuminate\Http\JsonResponse
     */
    public function index()
    {
        $lang = request('lang', 'cn');
        $group = request('group');
        if (!$group) {
            return json(201, trans("api.Parameter", [], $lang));
        }
        $key = request('key', '');
        $arr = BaseConfig::get($group, $key, "");

        return json(200,'BaseConfig Info', $arr);
    }
}
