<?php

namespace Modules\User\Http\Controllers\Admin;

use App\Admin\Traits\WithUploads;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Modules\User\Models\SignBanner;
use Modules\User\Models\SignChainLog;

class SignBannerController extends AdminController
{
    use WithUploads;

    protected $title = '签到背景图片';

    public function grid(): Grid
    {
        $grid = new Grid(new SignBanner());

        $grid->column('id', '#ID#');
        $grid->column('title', '标题');
        $grid->column('cover', '封面图')->image('', 100, 100);
        $grid->column('status', '状态')->bool();

        return $grid;
    }

    public function form(): Form
    {
        $form = new Form(new SignBanner());

        $form->text('title', '标题')->required();
        $this->cover($form);
        $form->switch('status', '状态')->default(1);

        return $form;
    }
}