Makes the array member stay filled after backend validation is failed
Makes the array member stay filled if the form is not successfully validated on the backend:
$item_presale_tokens = old('values.0');
$item_liquidity_tokens = old('values.1');
Form html looks like this:
<div class="form-group d-flex border-bottom-0">
    <div class="form-equal-inputs">
        <input type="number" step="1" min="1" value="{{ $item_presale_tokens }}" class="form-control {{ $errors->has('values.0') ? 'is-invalid' : '' }}" name="values[]" placeholder="Value"/>
    </div>
    

</div>

<div class="form-group d-flex border-bottom-0">
    <div class="form-equal-inputs">
        <input type="number" step="1" min="1" value="{{ $item_liquidity_tokens }}" class="form-control {{ $errors->has('values.1') ? 'is-invalid' : '' }}" name="values[]" placeholder="Value"/>
    </div>
</div>
by Valeri Tandilashvili
3 years ago
Laravel
0
Pro tip: use ```triple backticks around text``` to write in code fences