是否可以在数组['$ addhere']中分配变量?我在变量中分配了一个值,然后将其放入[]
这是变量
@php
$order_id=$orderItem->id;
@endphp
我想把它放在这里,
{{$partialDeliveries[$order_id]->stock_in_qty}}
错误响应
刀片中的表格
<table class="table table-striped m-b-none" id="orders" >
<thead>
<tr>
<th width="">Product Code</th>
<th>Product Name</th>
<th>Quantity</th>
<th>Delivery Date</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
@foreach($order->orderItems as $orderItem)
@php
$order_id=$orderItem->id;
@endphp
<tr>
<td>{{ $orderItem->product_code }} {{$order_id}}</td>
<td>{{ $orderItem->product_name }} {{$partialDeliveries[$order_id]->stock_in_qty}}</td>
{{-- <td> {{$orderItem->quantity}}</td> --}}
<td><input type="number" name="stock_in_qty[]" id="stock_in_qty_{{$orderItem->id}}" class="form-control stock_in_qty" min="1" value="{{$orderItem->quantity}}" data-max="{{$orderItem->quantity}}" onkeyup="check(this);"/></td>
<script type="text/javascript">
var $orderItem_id = {{$orderItem->id}};
$('#stock_in_qty_'+$orderItem_id).on('mouseup keyup', function () {
$(this).val(Math.min({{$orderItem->quantity}}, Math.max(1, $(this).val())));
});
</script>
<td> {{ Form::date('delivery_date[]',today(), ['class' => 'form-control date', 'style' => 'width:200px;','required']) }}</td>
<td>{!! Form::text('delivery_note[]', null, ['class'=>'form-control']) !!}
@if ($errors->has('delivery_note'))<span class="help-block"><strong>{{ $errors->first('delivery_note') }}</strong></span>@endif
</td>
</tr>
{!! Form::hidden('product_id[]', $orderItem->product_id) !!}
{!! Form::hidden('stock_in_qty[]', $orderItem->quantity) !!}
{!! Form::hidden('order_id[]', $order->id) !!}
{!! Form::hidden('order_item_id[]', $orderItem->id ) !!}
{!! Form::hidden('company_id[]', $order->company->id) !!}
{!! Form::hidden('stock_out_qty[]',null) !!}
{!! Form::hidden('transfer_to[]', null) !!}
{!! Form::hidden('user_id[]',auth()->user()->id ) !!}
@endforeach
</tbody>
</table>