简体   繁体   中英

How to wirte href attribute on if else condition on laravel?

I need to check 'perPage=100' and 'perPage=50' over URL on if-else clause.

 @if(perPage=100)
    <a class="btn btn-default btn-sm ajax-link back-btn" href="invoice-list?perPage=100" type="button" >Back to List</a>
@elseif(perPage=50)
<a class="btn btn-default btn-sm ajax-link back-btn" href="invoice-list?perPage=50" type="button" >Back to List</a>
@else
<a class="btn btn-default btn-sm ajax-link back-btn" href="invoice-list?perPage=10" type="button" >Back to List</a>
@endif

you can only write this line without any if:

<a class="btn btn-default btn-sm ajax-link back-btn" href="{{url('invoice-list?perPage=' . $perPage)}}" type="button">Back to List</a>

make sure that you have $perPage variable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM