handleRecordUpdate
Hi, I'm trying to get the relation data within the handleRecordUpdate
It's a resource page, not a modal... but I don't know how do I get the relationship data:
Can anyone help ? thanks!
protected function handleRecordUpdate(Model $record, array $data): Model
{
dd($record->toArray(), $data);
$record->editOrder($data);
$this->updateProductQty($record);
return $record;
} protected function handleRecordUpdate(Model $record, array $data): Model
{
dd($record->toArray(), $data);
$record->editOrder($data);
$this->updateProductQty($record);
return $record;
}It's a resource page, not a modal... but I don't know how do I get the relationship data:
return Repeater::make('items')
->relationship()
->schema([
Forms\Components\Select::make('shop_product_id')
->label('Product')
->translateLabel()
->options(Product::query()->pluck('name', 'id'))
->required()
->reactive()
->afterStateUpdated(fn ($state, Forms\Set $set) => $set('unit_price', Product::find($state)?->price ?? 0))
->distinct()
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->columnSpan([
'md' => 5,
])
->searchable(),return Repeater::make('items')
->relationship()
->schema([
Forms\Components\Select::make('shop_product_id')
->label('Product')
->translateLabel()
->options(Product::query()->pluck('name', 'id'))
->required()
->reactive()
->afterStateUpdated(fn ($state, Forms\Set $set) => $set('unit_price', Product::find($state)?->price ?? 0))
->distinct()
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->columnSpan([
'md' => 5,
])
->searchable(),Can anyone help ? thanks!