PoemTable.php
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
 * Created by PhpStorm.
 * User: lishuai
 * Date: 2022/1/10
 * Time: 5:57 PM
 */
namespace App\Admin\Renderable;
use App\Admin\Repositories\OnePoem;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class PoemTable extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(new OnePoem(), function (Grid $grid) {
            $grid->column('id', 'ID')->sortable();
            $grid->column('title');
            $grid->column('author');
            $grid->column('content');
            $grid->column('annotate');
//            $grid->column('spelling');
//            $grid->column('en');
            $grid->quickSearch(['title', 'author', 'content', 'annotate']);
            $grid->paginate(10);
            $grid->disableActions();
            $grid->filter(function (Grid\Filter $filter) {
                $filter->like('title')->width(3);
                $filter->like('author')->width(3);
                $filter->like('content')->width(3);
            });
        });
    }
}