MCPcopy Create free account
hub / github.com/CoderOpen/waimai / grid

Method grid

app/Admin/Controllers/ChiHe/LinkController.php:31–128  ·  view source on GitHub ↗

* Make a grid builder. * * @return Grid */

()

Source from the content-addressed store, hash-verified

29 * @return Grid
30 */
31 protected function grid()
32 {
33 $localAppId = request()->get('local_app_id', 0);
34 $csrf = csrf_token();
35 $script = <<<EOT
36 $('.grid-row-delete').unbind('click').click(function() {
37 var id = $(this).data('id');
38 var type = $(this).data('type');
39 swal({
40 title: "确认删除",
41 type: "warning",
42 showCancelButton: true,
43 confirmButtonColor: "#DD6B55",
44 confirmButtonText: "确认",
45 showLoaderOnConfirm: true,
46 cancelButtonText: "取消",
47 preConfirm: function() {
48 $.ajax({
49 method: 'post',
50 url: '/admin/series-product/delete/' + id + '?type=' + type,
51 data:{
52 _token:"$csrf"
53 },
54 success: function (data) {
55 $.pjax.reload('#pjax-container');
56 console.log(data);
57 if(data.code == 1){
58 swal(data.msg, '', 'success');
59 }else{
60 swal(data.msg, '', 'error');
61 }
62 }
63 });
64 }
65 });
66 });
67EOT;
68 Admin::script($script);
69
70 $comment = (new Link());
71 $showStatus = Link::showStatus();
72 $grid = new Grid($comment);
73 //$grid = $grid->model()->with('local_app');
74 //$grid->disableFilter();
75 $grid->column('id', 'ID')->sortable();
76 $grid->disableExport(); //禁止导出
77 $grid->disableRowSelector(); //禁止行checkbox选择
78 $grid->disableColumnSelector(); //禁止显示列显示选择器
79 //$grid->disableActions();
80 //$grid->disableCreateButton();
81
82 //$grid->disableActions();//$grid->column('pictures', '图片')->editable();
83 $grid->column('app_id', '友链应用ID');
84 $grid->column('app_name', '友链应用名称');
85 $grid->column('path', '友链应用路径')->editable();
86 $grid->column('description', '描述');
87 $grid->column('status', '显示与否')->editable()->select($showStatus);
88 $grid->column('sort', '排序')->editable();

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
showStatusMethod · 0.45

Tested by

no test coverage detected