简体   繁体   中英

How can I change link on View Button in Laravel Nova for one resource only?

I want to change the link on Laravel Nova View Button for a specific resource. By default, it moves to the default Details page but I want to redirect it to the another page that I have already made.

For example, I have a resource named Tools. So, in the default table, when I click on view button of a tool with id=20(say), it goes to resources/tools/20 which is the default laravel nova details page, but I want to change this link to tools/api-test. How can I do this?

Please give some suggestions related to it. Thanks in advance!!

I don't believe there is a way to override the default view link, but you can create a URL field and link to an arbitrary value.

URL::make('Receipt', fn () => $this->receipt_url)

The second argument can be a function that returns the URL that you wish to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM