Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Data for current model on detail page #4

Closed
hmakein opened this issue Apr 7, 2021 · 2 comments
Closed

Data for current model on detail page #4

hmakein opened this issue Apr 7, 2021 · 2 comments

Comments

@hmakein
Copy link

hmakein commented Apr 7, 2021

I'm using the customDetailToolbarComponents() method in a model, and I'm wondering if there's a way to pass in data about the current model that the detail page is displaying. My hope would be to at least get the model ID, then use that to pass the data I need as a second parameter on the addItem() method.

I tried getting the current model ID using request(), but that only provides information for the nova-vendor/nova-dynamic-views/{resource}/{method} route.

@bernhardh
Copy link
Owner

bernhardh commented Apr 8, 2021

Please have a look at the new release v1.3.0 where I have added this feature and updated the the docs (https://github.com/bernhardh/nova-dynamic-views#access-resource-data).

To sum it up, now you have access to the id with request('id'). Then you can query for the model:

$this->model()->query()->where('id', request('id'))->first();

Is your problem solved with this?

@hmakein
Copy link
Author

hmakein commented Apr 8, 2021

@bernhardh That worked perfectly. Thank you so much!

@hmakein hmakein closed this as completed Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants