Closed goldmerc closed 3 years ago
I realised I can get what I want from the request and pass it through to a custom event using the button key. Bit hacky but works...
Button::make('test', $this->getButtonKey())
->event(CustomEvent::class)
public function getButtonKey()
{
return implode('@', [
'viaResource' => request()->viaResource,
'viaResourceId' => request()->viaResourceId,
]);
}
Hi, if I have a HasMany or BelongsToMany relationship field, is there any way I can know the details of the parent?
So, let's say I have a Users resource with a hasMany relationship field to BlogPosts. When I view a user, I can see a table of their BlogPosts. I can use a custom resource for this...
HasMany::make('BlogPosts', null, 'BlogPostsListOnUsersDetailPage')
In the resource BlogPostsListOnUsersDetailPage I want to use the button field and be able to know the id of the related User.
Is this possible? Thanks.