get choosen item id

i have this code
    $total_amount = Pay::where('purchase_id', $purchase_id)
                                ->where('item_id', '!=', $excluded_item_id) // Exclude the specific item
                                ->sum('amount');

i want get choosen item id to pass for exlcuded_item_id
Was this page helpful?