hitech95
Download a generated file with Action button
Is there a simple way to download a file by pressing an action button?
My code already prepare a proper response with the correct mime type and body but the request is not handled correctly by the browser.
If I cannot use a direct download I need to use a URL but I need to send POST inputs to the request as I'm generating a PDF preview of the form.
11 replies
Reload Page on table row action success
Hi,
I have a EditPage for a resource that is showing a detail of the resource.
In this page I have a Form (FormBuilder).
Two of the fields are Livewire::make() components.
Such components are two Tables (Created via the TableBuilder).
On such tables I can "move" the rows between the two tables.
To do so I have an action that updates the Team players.
The action trigger the update of the table the action is triggered from,
but the other table is not updated. The only way to have the updated data is to manually refresh the page.
For example:
Resource: Game
Table 1: Team Red Players
Table 2: Team Blue Players
(Both table are the same Livewire Component, a TeamID is passed as a Livewire argument for the query builder of the table)
I've been struggling with this issue for some time and any input would be welcome.
31 replies
When saving/edit a resource create a new Model instance instead of update?
Hi,
I have the requirement to create a new resource when saving an form.
I'm using the
EditRecord
as my parent page but I'm overriding some methods.
For what I've seen I could override the save()
method.
What I'm doing is if a condition is met Instead of updating the model I create a new one and I assign it via $this->record
.
It seems to be working fine for the root model but this have two issues when relations comes in play.
The saveRelations()
chain is called this causes the child relations to be saved on the old $record.
To avoid this I can set the $record to null before the validation, this will fail on the saveRelationsBeforeChildren()
or similar method name.
While the "before" chain has been stopped from saving, at this point I have the new root Model saved.
I want to proceed with saving the relations, at this point the child relations are still saved with the wrong ID as the $record
is cached in most of the components.
Any idea to achieve this behavior?1 replies
Wizard pre-fill from template is it possible to achieve?
Hi,
I'm trying to get a form to be pre-filled by a template.
For example I might have a set of templates that I can select to fill a section of the form of a specific resource.
This section (In my case) is a relation (repeater).
My Idea is to create a Wizard action on "add" of the repeater where on first step it ask me to choose a template (select) and on second step it shows the selected template and you can apply the necessary changes.
Is something like this possible?
1 replies