Laravel-admin: How could I customize the "add button" URI in grid?

Created on 24 Mar 2017  ·  1Comment  ·  Source: z-song/laravel-admin

Hello,

The add button URI of the grid is defined by the currently URL.
For example,
Current URL: xxx.com/admin/articles
URI of add button: /admin/articles/create

If I want to change the URI of add button to something like /admin/comments/create, how should I do?

I have this idea because I put 2 grid with different model in the same page. Each of them need their own URI path of the add button.

Thank you.

Most helpful comment

You can't customize the add button.

But you can remove the button by using $grid->disableCreation();, and add a custom tool for grid like following:

$grid->tools(function ($tools) {
    $tools->append("<a href='your-create-URI' class='btn btn-default'>Create</a>");
});

>All comments

You can't customize the add button.

But you can remove the button by using $grid->disableCreation();, and add a custom tool for grid like following:

$grid->tools(function ($tools) {
    $tools->append("<a href='your-create-URI' class='btn btn-default'>Create</a>");
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

xiaalngf picture xiaalngf  ·  3Comments

qcol picture qcol  ·  3Comments

abufalbo picture abufalbo  ·  3Comments

zhenyangze picture zhenyangze  ·  3Comments

joernroeder picture joernroeder  ·  3Comments