1.可以去掉批量删除按钮
$grid->tools(function ($tools) {
$tools->batch(function ($batch) {
$batch->disableDelete();
});
});
2.自定义批量按钮
(1)先定义操作类app/Admin/Extensions/Tools/ReleasePost.php
<?php
namespace App\Admin\Extensions\Tools;
use Encore\Admin\Grid\Tools\BatchAction;
class ReleasePost extends BatchAction
{
protected $action;
public function __construct($action = 1)
{
$this->action = $action;
}
public function script()
{
return <<<EOT
$('{$this->getElementClass()}').on('click', function() {
$.ajax({
method: 'get',
url: '{$this->resource}/release',
data: {
_token:LA.token,
ids: selectedRows(),
action: {$this->action}
},
success: fun