<th>Category Name</th> <th>Product Name</th> <th>Bought Price</th> <th>Price</th> <th>Quantity</th> <th>Available</th> <th>Amount</th> <th>Remove</th> </tr> </thead> <tbody> <?php for ($i = 0; $i < count($sProducts) - 1; ++$i) { $productList = AppHelper::getProductByCid($sCategories[$i]); $boughtPrice = AppHelper::getBoughtPrice($sProducts[$i]); $available = AppHelper::getAvailable($sProducts[$i]); $productName = AppHelper::getProductName($sProducts[$i]); ?> <tr> <td> {!! Form::select('category'.($i+1), (['' => 'Select Category'] + $categories), $sCategories[$i], ['class' => 'form-control', 'id' => 'category'.($i+1), 'onChange'=>'getSalesProduct(this.id, this.value)', 'required']) !!} </td> <td> {!! Form::select('productName'.($i+1), (['' => 'Select Product'] + $productList), $sProducts[$i], ['class' => 'form-control', 'id' => 'productName'.($i+1), 'onChange'=>'getPrice(this.id, this.value)', 'required']) !!} </td> <td> <input class="form-control" type="text" name="buying_price{{$i+1}}" id="buying_price{{$i+1}}" value="{{$boughtPrice[0]->buying_price}}" readonly> </td> <td> <input class="form-control" type="text" name="price{{$i+1}}" id="price{{$i+1}}" value="{{$unit_price[$i]}}" readonly> </td>