Rebuild Infolist

Hi - again I'm having a problem with my infolist. The background is this - I have a Model called "Checkpoint" that has a BelongsToMany-Relation to a Model called "Tag". Now I've added an action to remove a tag from a checkpoint. Problem is, that when I click on the action, the tag still persists on the page, until it is reloaded. Is there a way to reload that section or the infolist automatically? ->live() seems to be not available here. This is my code so far:
Section::make('Tags')->columns(3)->schema(function (){
$schema = [];
foreach ($this->record->tags->sortBy('tagname') as $tag){
$schema[] = TextEntry::make('tag_'.$tag->id)
->label(false)
->state($tag->tagname)
->suffixAction(
Action::make('remove_tag_'.$tag->id)
->icon('heroicon-o-x-mark')
->button()
->color('danger')
->label(false)
->tooltip('Remove Tag')
->action(function ($record) use ($tag){
$record->tags()->detach($tag->id);
})
);
}
return $schema;
})
Section::make('Tags')->columns(3)->schema(function (){
$schema = [];
foreach ($this->record->tags->sortBy('tagname') as $tag){
$schema[] = TextEntry::make('tag_'.$tag->id)
->label(false)
->state($tag->tagname)
->suffixAction(
Action::make('remove_tag_'.$tag->id)
->icon('heroicon-o-x-mark')
->button()
->color('danger')
->label(false)
->tooltip('Remove Tag')
->action(function ($record) use ($tag){
$record->tags()->detach($tag->id);
})
);
}
return $schema;
})
Solution:
Okay - turns out my approach was ape-💩. I've created a "manage"-action and using this everything works as expected.
Jump to solution
1 Reply
Solution
Husky110
Husky11013mo ago
Okay - turns out my approach was ape-💩. I've created a "manage"-action and using this everything works as expected.
Want results from more Discord servers?
Add your server