Forms\Components\Select::make('store_id')->relationship('store', 'name') ->preload() ->searchable() ->required(),Repeater::make('sales_items')->schema([//The form products select and quantity textinput fields comes in here])->live() ->afterStateUpdated(function (Get $get, Set $set) { $total = 0; $store_id = $get('store_id'); foreach ($get('sales_items') as $item) { $product = StockAvailabilityStatus::where('product_id', $item['product_id'])->where('store_id', $store_id)->first(); if ($product && $item['quantity']) { $total += $product->bulk_selling_price * $item['quantity']; } } $set('formatted_total_amount', '₦' . number_format($total, 2)); })