How to create preview for formData
I am building an Builder with a live preview using an iframe. On the left you have an exam with categories. When the user refreshes it should only update the iframe. When the user clicks opslaan (save) it should save to db.
Onload categories are not shown, when refreshing its already saved to db (because $this->form->getState())
Problem
Adding ->dehydrated(true) on categories makes load on mount and also updates in the preview data. (still updates on preview)
Switching ->model($this->exam) to ->model(Exam::class). The preview is not automatically saving anymore, but when updating it creates a new record instead of updating the current (relation gone).
Onload categories are not shown, when refreshing its already saved to db (because $this->form->getState())
Problem
- On load the categories are not shown in the preview
- When clicking refresh, the data is already saved to the database (because $this->form->getState())
Adding ->dehydrated(true) on categories makes load on mount and also updates in the preview data. (still updates on preview)
Switching ->model($this->exam) to ->model(Exam::class). The preview is not automatically saving anymore, but when updating it creates a new record instead of updating the current (relation gone).

