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,comment,return,admin,function,comments,模态,new,model From: https://www.cnblogs.com/zjj1990/p/17119870.html