laravel-admin 弹出模态框

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());
    }
});

 

posted @ 2023-02-14 15:49  不一样的开始  阅读(343)  评论(0编辑  收藏  举报