use Encore\Admin\Widgets\Table;
$grid->column('title', '标题')->expand(function ($model) {
$comments = $model->comments()->take(10)->map(function ($comment) {
return $comment->only(['id', 'content', 'created_at']);
});
return new Table(['ID', '内容', '发布时间'], $comments->toArray());
});
$grid->column('goods_name', '商品名称')->modal('最新评论', function ($model) {
if ($this->goods_type){
$model = new Member();
$comments = $model->take(10)->get()->map(function ($comment) {
return $comment->only(['id', 'real_name', 'created_at']);
});
return new Table(['ID', '内容', '发布时间'], $comments->toArray());
}
});
laravel-admin 弹出模态框
最新推荐文章于 2024-07-24 21:04:47 发布