
图中代码涉及到闭包嵌套,除了逐级传递还有什么方法使用$data变量嘛
$data = Conference::pluck('date','date')
->flatten(1)
->all();
return Admin::content(function (Content $content) use ($data) {
$content->header('会议');
$content->description('列表');
$content->row(function (Row $row) use ($data) {
$row->column(6, function (Column $column) use ($data) {
$column->append((
new Box(
$data, $this->grid()
)));
});
});
});
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
直接在
return的最后调用原数据,不用传参用
$this->tempData代替闭包传值global $data;?写成类吧 直接在函数里面使用$this->data不是很方便?
Admin::content() 源代码 不清楚 上下文看应该插入会议详细的功能