How do you add actions to an infolist inside a resource opened in a slideover? #10370
GitHub
How do you add actions to an infolist inside a resource opened in a...
I have this resource StoryResource. When i open the view action in a slideOver I want to add actions to the infolist view in the panel. I can add the actions and they show up, but when i click on t...
1 Reply
I've finally wrangled a viewentry with a livewire compoent to call the action and it works, but the dispath event is not being called or caught...
Another update, I don't know if I'm doing it right but after lots f trial and error this is what i ended up with.... seems not right but it works...
On the resource..
ViewActions::make('view_story_actions')->hidden(fn(Model $record) => $record->completed),
In listStories page
protected $listeners = ['updatedStory' => '$refresh'];
public function markCompletedAction(): Action
{
return Action::make('markCompleted')
->action(function(array $arguments){
$story = data_get($arguments, 'story');
$story = Story::find($story['id'])->markCompleted();
// $story->markCompleted();
$this->dispatch('updatedStory', ['story' => $story]);
});
}
in the custom view
{{ ($this->markCompletedAction)(['story' => $getRecord()]) }}