real time data from database in form builder

We have poll for table builder do we something like that form builder i want to use that so i do not have to refresh the page everytime
4 Replies
Dennis Koch
Dennis Koch15mo ago
That’s a really complex topic. What are you trying to archive?
ba_mbi_07
ba_mbi_07OP15mo ago
I have a tabs inside that I have a rich editor field and a action button ...in action I am opening a modal where I am saving some data which will reflect in rich editor data
LeandroFerreira
LeandroFerreira15mo ago
GitHub
How to Re-fetch input field value after update Database · filamentp...
How can i refetch only license_key field data from the database after the action? Right now i have to reload the Edit page. I want to avoid that and update only that corresponding input field data?...
ba_mbi_07
ba_mbi_07OP15mo ago
i used this $livewire->refreshFormData(['license_key']); It does not seem working for my case
if ($sport?->name == "Football") {
$schema[] = Actions::make([
Action::make("add_commentary")->label('Add Commentary')
->form([
Textarea::make('commentary')->label("Add to Commeny for Football Match")
])
->action(function ($data, $record) use ($competitionMatchInsights) {
if (isset($data["commentary"])) {
foreach ($competitionMatchInsights as $matchInsight) {

$newEntry = [ 'event' => "custom commentary",'sentence' => $data["commentary"] ];
$commentaryData = $matchInsight->commentary;
$commentaryData[] = $newEntry;
$matchInsight->update(['commentary' => $commentaryData]);
to_route('filament.admin.resources.match-lists.view', ['record' => $record->id]);
}
}
})
]);


$schema[] = RichEditor::make("football_commentary")
->afterStateHydrated(function ($component) use ($competitionMatchInsights) {
$test = [];
foreach ($competitionMatchInsights as $commentaryEntry) {
foreach (array_reverse($commentaryEntry->commentary) as $commentaryEntryData) {
$commentaryText = "<p>" . $commentaryEntryData["sentence"] . "</p>";
$test[] = $commentaryText;
}
}
return $component->state(implode("", $test));
});
}
if ($sport?->name == "Football") {
$schema[] = Actions::make([
Action::make("add_commentary")->label('Add Commentary')
->form([
Textarea::make('commentary')->label("Add to Commeny for Football Match")
])
->action(function ($data, $record) use ($competitionMatchInsights) {
if (isset($data["commentary"])) {
foreach ($competitionMatchInsights as $matchInsight) {

$newEntry = [ 'event' => "custom commentary",'sentence' => $data["commentary"] ];
$commentaryData = $matchInsight->commentary;
$commentaryData[] = $newEntry;
$matchInsight->update(['commentary' => $commentaryData]);
to_route('filament.admin.resources.match-lists.view', ['record' => $record->id]);
}
}
})
]);


$schema[] = RichEditor::make("football_commentary")
->afterStateHydrated(function ($component) use ($competitionMatchInsights) {
$test = [];
foreach ($competitionMatchInsights as $commentaryEntry) {
foreach (array_reverse($commentaryEntry->commentary) as $commentaryEntryData) {
$commentaryText = "<p>" . $commentaryEntryData["sentence"] . "</p>";
$test[] = $commentaryText;
}
}
return $component->state(implode("", $test));
});
}
Want results from more Discord servers?
Add your server