<?php
namespace App\Admin\Controllers;

use App\Admin\Metrics\Examples;
use App\Http\Controllers\Controller;
use Dcat\Admin\Http\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Admin;
use Illuminate\Http\Request;
use App\Admin\Controllers\BaseController;

class HomeController extends BaseController
{

    public function index(Content $content)
    {
        return $content->body(view('index', [
                'dhUrl' => admin_url('dh'), // 生成路由URL
            ]));
    }

    public function changesddm(Request $request){
        $input=$request->input();
        $user = Admin::user();
        $user->sddm = $input['sddm']; // 修改指定字段值
        $res=$user->save(); // 保存修改
        if ($res) {
            return response()->json([
                'error' => 0,
                'msg' => '成功',
            ]);
        }else{
            return response()->json([
                'error' => 1,
                'msg' => '失败',
            ]);
        }
    }



}
