<?php

namespace App\Http\Controllers\Admin\Api;

use App\Http\Controllers\Controller;
use App\libs\Response\GlobalApiResponse;
use App\Models\Setting;
use Illuminate\Http\Request;


class SettingsController extends Controller
{
    public function getAppVersion()
    {
        $data = Setting::all('app_version')->first();
        return (new GlobalApiResponse())->success('App version', 1, $data);
    }

    public function saveAppVersion(Request $request)
    {
        $setting = Setting::findOrFail(1);
        $setting->app_version = $request->app_version;
        $setting->save();
        return (new GlobalApiResponse())->success('App version successfully updated');
    }
}
