Filling a form on editPage

i need filling with the previously information of a table, on a edit page, like the discount, modules, and checkbox.

I think my problem may be because the first data is from the budget and not from the client, this is because in the create I must have the possibility of creating a budget and a client in the chaos that is chosen.

The problem is that when editing it from the table, it does not fill in the data with which it is linked. I have already tried fill(), getChildsContainers, with another form, with eloquent, and it still does not fill them in.

If anyone has an idea I would greatly appreciate it.

my create code is:

public function create(bool $another = false): void
{
$form = $this->form->getState();

if ($form['budget_client_id']) {
$client = BudgetClient::query()->create([
'email' => $form['email'],
'name' => $form['name'] ?: '',
'last_name' => $form['last_name'] ?: '',
'telephone' => $form['telephone'] ?: '',
'comments' => $form['comments'] ?: '',
]);
}

Budget::query()->create([
'budget_client_id' => $client->id ?? null, // Set based on client creation
'modules' => $form['modules'],
'discount' => $form['discount'],
'total_price' => $form['total_price'],
]);

$this->redirect(BudgetResource::getUrl());
}


There are parts of my code that don't work, such as price persistence, but for now I'm interested in fixing this first.

the message is so long, so i give u mi code on another message
image.png
image.png
image.png
Was this page helpful?