Submit with more than one record in the same column

I have a configuration table with key, value, configTypeId and description fields. I need to send different values for the same column in the form below, just changing the configTypeId. I'm having problems, because my submit method only contains the last data at the end of the form.
public Config $config;
public function mount(): void
{
$configPayment = Config::where('config_type_id', 2)->get();
$configLogo = Config::where('config_type_id', 3)->get();

$this->form->fill([
'key' => [
'payment' => $configPayment[0]->key,
'logo' => $configLogo[0]->key,
],
'description' => [
'payment' => $configPayment[0]->description,
'logo' => $configLogo[0]->description,
],
'value' => [
'payment' => $configPayment[0]->value,
'logo' => $configLogo[0]->value,
],
]);
}

public function submit(): void
{
$data = $this->form->getState();
dd($data);
...
public Config $config;
public function mount(): void
{
$configPayment = Config::where('config_type_id', 2)->get();
$configLogo = Config::where('config_type_id', 3)->get();

$this->form->fill([
'key' => [
'payment' => $configPayment[0]->key,
'logo' => $configLogo[0]->key,
],
'description' => [
'payment' => $configPayment[0]->description,
'logo' => $configLogo[0]->description,
],
'value' => [
'payment' => $configPayment[0]->value,
'logo' => $configLogo[0]->value,
],
]);
}

public function submit(): void
{
$data = $this->form->getState();
dd($data);
...
` I would need the payment keys to come and then. just like the value and description fields, come from all!
No description
No description
No description
2 Replies
Want results from more Discord servers?
Add your server