Level 1
You can use the function hideFromDetail and give a callback as a parameter to hide the field as you want:
HasMany::make('Posts', Post::class)
->hideFromDetail(fn () => $this->posts->isEmpty()),
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is there a way to hide a HasMany relation table in nova?
I have three different HasMany relations that I only want the resource to generate the view if there are any results, otherwise I want it hidden from view.
Is that possible?
You can use the function hideFromDetail and give a callback as a parameter to hide the field as you want:
HasMany::make('Posts', Post::class)
->hideFromDetail(fn () => $this->posts->isEmpty()),
Please or to participate in this conversation.