<?php

namespace Modules\User\Http\Controllers\Admin;

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

class SmsController extends AdminController
{

    protected $title = '短信记录';

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

        $grid->disableCreateButton();
        $grid->disableActions();

        $grid->filter(function (Grid\Filter $filter) {
            $filter->column(1 / 3, function (Grid\Filter $filter) {
                $filter->equal('mobile', '接收手机');
            });
        });

        $grid->column('mobile', '接收手机');
        $grid->column('channel', '短信渠道');
        $grid->column('gateway', '发送网关');
        $grid->column('content', '短信内容');
        $grid->column('used', '使用')->bool();
        $grid->column('created_at', '发送时间');

        return $grid;
    }

}