© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•7mo ago•
15 replies
matin rajabi

issue with repeater and relationship

hey, i have a simple form with simple logic to submit


protected function handleRecordCreation(array $data): Model {

$user = \App\Models\User::firstOrCreate(
['phone' => $data['phone']],
['password' => bcrypt(Str::random(8))]
);

$data['user_id'] = $user->id;
// قیمت نهایی محصولات
$totalProductPrice = 0;
foreach ($data['order_details'] as $item) {
$product = \App\Models\Product::find($item['product_id']);
$price = $product->price_for_quantity($item['quantity']);
$totalProductPrice += ($price * $item['quantity']);
}

// محاسبه هزینه ارسال
if (isset($data['send_id'])) {
$send = \App\Models\Send::find($data['send_id']);
$sendPrice = $send?->price ?? 0;
} else {
$sendPrice = $data['custom_send_price'] ?? 0;
}

// مجموع نهایی قیمت
$data['price'] = $totalProductPrice;
$data['send_price'] = $sendPrice;
$data['final_price'] = $totalProductPrice + $sendPrice;

$record = static::getModel()::create($data);

return $record;
}

but it tries to save related record into order_details. i don't know why is the reason?
message.txt6.75KB
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Issue with halt() on beforeSave and a repeater with relationship
FilamentFFilament / ❓┊help
2y ago
Repeater with relationship and group by
FilamentFFilament / ❓┊help
3y ago
Repeater with hasMany relationship
FilamentFFilament / ❓┊help
3y ago
Issue with Repeater
FilamentFFilament / ❓┊help
2y ago