Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dipherent's avatar

How to link to the public (frontend) view for a Nova resource?

Hi friends,

I am using Nova for the admin side of my project, and I am creating listings in the admin using Nova and they are rendered in blade and are listed on the front page of the website.

In my admin, I want to be able to click on the listing and view the public(frontend) listing page. For now, when I click on it, it gives me the "show" page inside Nova.

I feel silly to ask this question because I feel the answer should be easy and I am missing something,

Thanks for your help,

0 likes
4 replies
dipherent's avatar

Hi @amaury Thanks for your answer, but how do I enter the link in the callback above ... the link I use in blade is:

{{route('listing.show', $listing)}}

How would I fit it in? Please pardon me I am a beginner,

Thanks

Amaury's avatar
Amaury
Best Answer
Level 43

You may use $this to access the resource's underlying model attributes and relationships.

Text::make('Show', function () {
 
   return '<a href="' . route('listing.show', $this->id )  . '" target="_blank">show</a>';

})->asHtml(),
1 like
dipherent's avatar

@amaury Thanks a lot buddy, I used your solution in combination with the Link field and did this:


Link::make('Public Link', 'listing')
                ->url(function () {
                    if($this->list){
                        return route('listings.show', $this->id);
                    }
                })->hideWhenCreating()->hideWhenUpdating()
                ->text('Check Public View')
                ->icon()
                ->blank(),

Thanks again for your help. Highly appreciated.

Please or to participate in this conversation.