How do I pass values through a render hook?
I have the following hook for my EditUser::class
but the view takes a prop of
@props(['userId'])
how do I get this from my EditUser::class and into the view?2 Replies
$record->id is what I'm trying to get to the view in particular.
This didn't work, but I think I'm attempting something like this...
I've made some progress and got the view working, but this doesn't feel right. Is there a better way to access the $record from the EditUser::class in my view?
For reference, I'm using the renderHook() in my panel service provider.
I've run across the same thing, and found a different slightly hacky approach:
You can add the record id in the getRenderHookScopes method of (e.g.) the ViewRecord class, so put in something like:
So then in the render hook you can access that id like:
It's nasty, and I wil be adding some more checks to this to prevent crashes etc. but the idea works.