<?php

namespace Modules\User\Http\Controllers\Admin;

use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Grid;
use Modules\User\Models\UserCertification;

class CertificationController extends AdminController
{
    protected $title = '认证记录';

    protected function grid(): Grid
    {
        $grid = new Grid(new UserCertification());

        $grid->disableCreateButton();
        $grid->disableActions();
        $grid->filter(function (Grid\Filter $filter) {
            $filter->column(1 / 3, function (Grid\Filter $filter) {
                $filter->like('name', '姓名');
            });
            $filter->column(1 / 3, function (Grid\Filter $filter) {
                $filter->equal('id_card', '身份证号');
            });
        });

        $grid->column('id', '#ID#');
        $grid->column('name', '姓名');
        $grid->column('id_card', '身份证号');
        $grid->column('created_at', '申请时间');

        return $grid;
    }
}