我有这个网址:
http://test.dev/search?publishing_types[]=Selling&priceFrom=0&priceTo=300000&areaFrom=0&areaTo=300000&floors[]=2&yearFrom=1900&yearTo=2017
现在我想要的是这样的:
<input type="checkbox" class="preventUncheck" name="publishing_types[]" id="toggle-on{{ $index }}" value="{{ $prop_type }}" @if (publishg_types== Selling) {!! "checked" !!} @endif >
<input type="checkbox" class="preventUncheck" name="publishing_types[]" id="toggle-on{{ $index }}" value="{{ $prop_type }}" @if (publishg_types== Reng) {!! "checked" !!} @endif >
所以我想要的是检查来自网址的publishing_types == Selling
和/或publishing_types == Rent
复选框以检查该复选框
答案 0 :(得分:0)
使用request()
这样的帮助:
<input type="checkbox" class="preventUncheck" name="publishing_types[]" id="toggle-on{{ $index }}" value="{{ $prop_type }}" @if (in_array('Selling', request(publishg_types)) {!! "checked" !!} @endif >
<input type="checkbox" class="preventUncheck" name="publishing_types[]" id="toggle-on{{ $index }}" value="{{ $prop_type }}" @if (in_array('Reng', request(publishg_types)) {!! "checked" !!} @endif >