laravel-admin 如何在异步加载框回显选择的表格信息或者选择的表格ID?
1. 运行环境
1). 当前使用的 Laravel 版本?
2). 当前使用的 php/php-fpm 版本?
PHP 版本:7.4
php-fpm 版本:
5). 相关软件版本
laravel-admin版本是1.7的
2. 问题描述?
我在表格里面添加了一个批量操作按钮,如何把表格选择的ID传入到form方法里面去?
<?php
namespace App\Admin\Actions\Post;
use App\Admin\Controllers\CommonController;
use Encore\Admin\Actions\BatchAction;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
/**
* 订单列表批量下单
*
* Class BatchRechargePost
* @package App\Admin\Actions\Post
*/
class BatchShipPost extends BatchAction
{
protected $selector = '.batch-recharge-post';
public function handle(Collection $collection, Request $request)
{
try {
foreach ($collection as $model) {
}
return $this->response()->success('提交成功')->refresh();
}catch (\Exception $exception){
return $this->response()->error($exception->getMessage());
}
}
public function form()
{
$this->textarea('mark', '备注');
$this->confirm('下单后不可取消,请谨慎操作,是否批量下单?');
}
public function html()
{
return <<<HTML
<a class="btn btn-sm btn-primary batch-recharge-post">合并发货</a>
HTML;
}
}
3. 您期望得到的结果?
希望能像行内操作一样可以在弹出的模拟框回显选择数据信息
推荐文章: