F
Filament12mo ago
ots

custom page repeater does not delete from database

public function editShippingForm(Form $form): Form
{
return $form->schema([
Repeater::make(__('labels.shipping_methods'))
->schema([
TextInput::make('erp_code')
->required()
->label(__('labels.erp_or_store')),
TextInput::make('store_code')
->label(__('labels.store_code'))
->required(),
])
->columns(2)
->addActionLabel(__('labels.new_entry'))
->statePath('shippingData')
]);
}
public function editShippingForm(Form $form): Form
{
return $form->schema([
Repeater::make(__('labels.shipping_methods'))
->schema([
TextInput::make('erp_code')
->required()
->label(__('labels.erp_or_store')),
TextInput::make('store_code')
->label(__('labels.store_code'))
->required(),
])
->columns(2)
->addActionLabel(__('labels.new_entry'))
->statePath('shippingData')
]);
}
in this form when removing a repeated text input it does update the state but does not actually remove it from the database. is there a way to link the model in this custom page? or a way to override the default delete function? This is how my data is mounted
$shippingData = SettingsShipping::all();


$formattedShippingData = [];

foreach ($shippingData as $shippingDatum) {
$formattedShippingData[] = [
'erp_code' => $shippingDatum->erp_code,
'store_code' => $shippingDatum->store_code,
];
}

$this->editShippingForm->fill(['shippingData' => $formattedShippingData]);
$shippingData = SettingsShipping::all();


$formattedShippingData = [];

foreach ($shippingData as $shippingDatum) {
$formattedShippingData[] = [
'erp_code' => $shippingDatum->erp_code,
'store_code' => $shippingDatum->store_code,
];
}

$this->editShippingForm->fill(['shippingData' => $formattedShippingData]);
1 Reply
ots
otsOP12mo ago
any insights?
Want results from more Discord servers?
Add your server