Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel blade shorthand if

<form action="?" method="get" id="sort_form">
                        @foreach($data['sorts'] as $key=> $sort)
                            <th>
                                <a href="{{ route("admin.review.index") }}?{{ $sort['table'] }}={{ (!is_null(request()->get($sort['table'])) && isset($sort['table']) && request()->get($sort['table']) == "desc") ? "asc" : "desc"}}">
                                    {{ $sort['name'] }}
                                    <i class="bi bi-sort-{{ request()->get($sort['table']) == "asc"?"down":"up"}}"></i>
                                </a>
                            </th>
                        @endforeach
                    </form>
 
PREVIOUS NEXT
Tagged: #laravel #blade #shorthand
ADD COMMENT
Topic
Name
8+6 =