<?php

namespace App\Admin\Controllers;

use App\Models\IntegralSetting;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class IntegralSettingController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new IntegralSetting(), function (Grid $grid) {
            $grid->column('id')->sortable();
            //$grid->column('keyword');
            $grid->column('desc')->editable();
            $grid->column('amount')->editable();
            $grid->column('status')->switch();
            $grid->column('updated_at');
        
            $grid->disableCreateButton();
            $grid->disableActions();
            $grid->disableBatchActions();
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new IntegralSetting(), function (Form $form) {
            $form->display('id');
            $form->switch('status');

            $form->footer(function ($footer) {
                // 去掉`查看`checkbox
                $footer->disableViewCheck();
                // 去掉`继续编辑`checkbox
                $footer->disableEditingCheck();
                // 去掉`继续创建`checkbox
                $footer->disableCreatingCheck();
            });
        });
    }

}
