Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel $loop->iteration

{{$loop->iteration}} 
Comment

laravel $loop interation

$loop->iteration =>	The current loop iteration (starts at 1).
  
@foreach ($users as $user)
{{$loop->iteration}}  
@endforeach
Comment

laravel $loop->iteration

@foreach($listdata as $data)
	// normal iteration
		{{ $data->iteration() }}

	// if you using "paginate()" in your query, better use this iteration per-page below:
		// for example:
			// page 1 iteration = 1,2,3,4,5 ascending, 5,4,3,2,1 descending
			// and page 2 iteration will be = 6,7,8,9,10 ascending, 10,9,8,7,6 descending

        // iteration ascending (1,2,3,...)
            {{ $data->firstItem() + $loop->index }}

        // iteration descending (...,3,2,1)
            {{ ($data->total()-$loop->index) - (($data->currentpage()-1) * $data->perpage()) }}
@endforeach
Comment

PREVIOUS NEXT
Code Example
Php :: update json file php 
Php :: minuscule chaine php 
Php :: wordpress single post get category name 
Php :: laravel collection count 
Php :: php support block-level scope 
Php :: php remove specific element from array 
Php :: add column in laravel migration 
Php :: install php linux nginx command line 
Php :: read csv php 
Php :: appending txt file from php 
Php :: console php 
Php :: Remove all attributes from HTML tags in PHP 
Php :: composer allowed memory size 
Php :: Too Many Attempts. laravel error 
Php :: how to get previous month in php 
Php :: php current date 
Php :: php iterate array keys 
Php :: php get unique values by key from array 
Php :: laravel url previous 
Php :: how to exclude csrf in a route laravel 
Php :: laravel orderby with relation 
Php :: php mysql if not exists insert 
Php :: how to get the current year in php 
Php :: strtoupper 
Php :: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) 
Php :: Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, bool given in C: ewxammphtdocslearnindex.php on line 11 
Php :: table drop foreign php laravel 
Php :: To store data in the session Laravel 
Php :: foreignid in laravel 
Php :: php in javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =