laravel-admin 新增,刪除,批量操作,匯入匯出,修改 等頁面按鈕 顯示與關閉

鐵金木發表於2020-11-28
$grid->actions(function ($actions) {
    // 去掉檢視
    $actions->disableView();

});


  //去掉核取方塊
  $grid->disableRowSelector();
  //禁用行操作
  $grid->disableActions();

  //禁用單選框$grid->disableRowSelector();//禁用新增按鈕$grid->disableCreation();


  $grid->actions(function ($actions) {    //關閉行操作 刪除    $actions->disableDelete();});
//關閉批量操作$grid->tools(function ($tools) {    $tools->batch(function ($batch) {        $batch->disableDelete();    });});
$form

        //表單bottom
        $form->disableReset();
        $form->disableEditingCheck();
        $form->disableViewCheck();

        //表單右上角
        $form->tools(function (Form\Tools $tools) {
            $tools->disableDelete();
            $tools->disableView();
        });

$grid
     // 表單右上角
         $grid->disableExport();
        $grid->disableCreation();
        // 操作按鈕
        $grid->actions(function (Grid\Displayers\Actions $actions) {
            $actions->disableDelete();
            $actions->disableEdit();
            $resDemand = Demand::find($actions->getKey());
            $edit_html='';
            //通過
            if($resDemand->status==1){
                $edit_html.="<span class='mb-5'><a class='grid-row-pass' title='通過' data-id='{$actions->getKey()}'><i class='glyphicon glyphicon-ok'></i></a></span>";
 
            $actions->append($edit_html);
        });
//  批量操作
        $grid->tools(function (Grid\Tools $tools) {
            $tools->batch(function (Grid\Tools\BatchActions $actions) {
                $actions->disableDelete();
            });
        });
$show
        //表單右上角
        $show->panel()->tools(function ($tools){
            $tools->disableDelete();
            $tools->disableEdit();
        });

 

相關文章