<?php

namespace App\Admin\Controllers\Coupon;

use App\Admin\Actions\Coupon\SettleCoupon;
use App\Models\ActivityRule;
use App\Models\Coupon;
use App\Models\CouponPaCheck;
use App\Models\User;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Grid;

class PaCouponController extends AdminController
{

    protected $title = '未找到数据';

    /**
     * Notes:
     *
     * @Author: <C.Jason>
     * @Date  : 2019/9/18 14:50
     * @return Grid
     */
    protected function grid(): Grid
    {
        $grid = new Grid(new CouponPaCheck());

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


        $grid->model()->oldest('id');

        $grid->filter(function ($filter) {
            $filter->column(1 / 2, function ($filter) {
                $filter->equal('pa_order_id', '平安主订单号');
            });
        });

        $grid->column('id', '#ID#');

        $grid->column('pa_order_id', '平安主订单号');

        $grid->disableExport(false);

        $grid->export(function ($export) {
            $export->filename($this->title.date("YmdHis"));
        });

        return $grid;
    }

}
