<?php

namespace App\Http\Controllers\V1;

use App\Models\BaseConfig;
use App\Models\SystemConfig;

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

    /**
     * 获取配置
     * @return \Illuminate\Http\JsonResponse
     */
    public function index()
    {
        $group = request('group');
        if (!$group) {
            return $this->error(trans("api.PARAMS_ERROR"));
        }
        $key = request('key', '');
        $arr = SystemConfig::get($group, $key, "");

        return $this->success($arr);
    }
}
