sparmin
sparmin
FFilament
Created by sparmin on 11/4/2024 in #❓┊help
How to refresh form data?
Yes. The attributes are correctly updated, the logic works just as intended. And I think I found the reason for this behavior, although I don't fully get it. So the Game has the attribute current_round, which is a foreign key and references the Round object. The Game object also has the method Game::currentRound() though which calls return $this->hasOne(Round::class, 'id', 'current_round'); So when I display the status message 'Current round' . $game->currentRound->sort I call the referenced Round object and the status message does not refresh. But if I change it to 'Current round' . $game->current_round which is the actual attribute of the Game object it does refresh automatically (although it shows the id of the referenced Round object instead of the desired Round::sort attribute. So I assume there's a delay or so by calling the referenced object..
15 replies
FFilament
Created by sparmin on 11/4/2024 in #❓┊help
How to refresh form data?
Yes, the Game object is also a db table, so the attributes are saved there. If that was the question. And yes, the actions update the attributes
15 replies
FFilament
Created by sparmin on 11/4/2024 in #❓┊help
How to refresh form data?
The Game model has several attributes is_running, is_finished and current_round. Depending on the combination of these attributes I display status messages like "The game has not started yet" or "Current round: ..." including the according buttons "Start game" or "Next round". These buttons are actions which make changes to the Game object. You can see more details in the screenshots above.
15 replies
FFilament
Created by sparmin on 11/4/2024 in #❓┊help
How to refresh form data?
Nope, the status of my game control, which I try to refresh automatically, i.e. "Current round: ..."
15 replies
FFilament
Created by sparmin on 11/4/2024 in #❓┊help
How to refresh form data?
Doesn't work unfortunately. I've even tried solving it quick&dirty by forcing a reload via JS but that also didn't work, the page reloaded but the status message stayed the same: const gameControl = document.getElementById("data.game-control"); if (gameControl) { const button = gameControl.querySelector("button"); if (button) { button.addEventListener("click", function () { location.reload(true); }); } }
15 replies
FFilament
Created by sparmin on 11/4/2024 in #❓┊help
How to refresh form data?
Oh.. right.. of course🙈
15 replies
FFilament
Created by sparmin on 11/4/2024 in #❓┊help
How to refresh form data?
Thanks for the quick reply! Where exactly would I put that? Haven't had much Livewire experience so far
15 replies