AuthorTable.php
986 Bytes
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
<?php
/**
* Created by PhpStorm.
* User: lishuai
* Date: 2022/1/10
* Time: 5:57 PM
*/
namespace App\Admin\Renderable;
use App\Admin\Repositories\OnePoem;
use App\Models\Author;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class AuthorTable extends LazyRenderable
{
public function grid(): Grid
{
return Grid::make(new Author(), function (Grid $grid) {
$grid->column('id', 'ID')->sortable();
$grid->column('name');
$grid->column('dynasty');
$grid->column('introduce');
$grid->column('state')->switch();
$grid->quickSearch(['name', 'dynasty', 'introduce']);
$grid->paginate(10);
$grid->disableActions();
$grid->filter(function (Grid\Filter $filter) {
$filter->like('name')->width(3);
$filter->like('dynasty')->width(3);
$filter->like('introduce')->width(3);
});
});
}
}