Laravel-admin: Grid组件的actions怎么获取行数据?

Created on 5 May 2017  ·  4Comments  ·  Source: z-song/laravel-admin

我想在操作里面增加一个按钮, 按钮里面增加一个url带有这行数据的主键ID.
但是我不知道怎么才能获取到, 请问应该如何获取到ID?

Most helpful comment

//範例

$grid->actions(function ($actions) {
    $id = $actions->row->id;
    $actions->append('<a href="/admin/' . $id . '/add/user/create" class="fa fa-user-plus"></a>');
});

All 4 comments

要看下你的按钮是怎么写的

已经解决了, $actions对象里面有row对象.

@chenzi2015 大兄弟,如何在Action裏增加按鈕?

//範例

$grid->actions(function ($actions) {
    $id = $actions->row->id;
    $actions->append('<a href="/admin/' . $id . '/add/user/create" class="fa fa-user-plus"></a>');
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

antranapp picture antranapp  ·  3Comments

benny-sun picture benny-sun  ·  3Comments

clock1129 picture clock1129  ·  3Comments

evans-kim picture evans-kim  ·  3Comments

taimaiduc picture taimaiduc  ·  3Comments