[Question] How to pass data from the resource to the card
Closed this issue · 1 comments
LorenzoSapora commented
I am using these cards in ->onlyOnDetail()
, but cannot seem to get $this->someColumn
in the html block. Is this even possible?
Example:
public function cards(Request $request)
{
return [
(new HtmlCard)->onlyOnDetail()->html('<div>'.$this->id.'</div>')
];
}
$this->id
displays nothing, but $this->all()
displays the content 🤔
I can pull the information manually, but I should have access to it already, but cannot work out why not
Thanks
alies-dev commented
hey @LorenzoSapora
sorry, this question is not related to this package, it's about Nova itself. There are few related topic on laravel/nova-issues repo regarding this issue. You can try to use $this->model()->id
. Alternatively you can explore $request object or it's trait: \Laravel\Nova\Http\Requests\InteractsWithResources