Answers for "for loop in array with count in laravel blade"

PHP
0

Laravel loop with counter

@foreach($rows as $row)
            <tr>
                <td>{{ $loop->iteration }}</td>
                <td>{{ $row->item1}}</td>
                <td>{{ $row->item2}}</td>
            </tr>
 @endforeach
Posted by: Guest on September-25-2021
0

laravel blade get array count in Blade

You can use the php count function to count the length of an array.

http://php.net/manual/en/function.count.php
EXAMPLE:

@if (count($array) > 0)
    {{-- expr --}}
@endif
Posted by: Guest on January-07-2022

Browse Popular Code Answers by Language