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

Mohammed-H's avatar

Laravel nova action fields

Hi everybody I am building a dashboard with Laravel Nova, and i have an action that gonna be performed only on the detail. I need to populate a field based on the resource,

My question is how can i grab the current model in the fields method ? Thanks

0 likes
4 replies
Ashraam's avatar

You can do something like

Text::make('Field name', function() {
    return $this->a.'/'.$this->b;
})->onlyOnDetail()
Mohammed-H's avatar

@ashraam Thanks for your reply but the fields method is on the action class not the resource so didn't work :(

Mohammed-H's avatar

@elo thanks for your response but that doesn't respond my question :(

Please or to participate in this conversation.