Skip to main content

Loop variables Laravel 4.8

Property Description
$loop->index The index of the current loop iteration (starts at 0).
$loop->iteration The current loop iteration (starts at 1).
$loop->remaining The iteration remaining in the loop.
$loop->count The total number of items in the array being iterated.
$loop->first Whether this is the first iteration through the loop.
$loop->last Whether this is the last iteration through the loop.
$loop->depth The nesting level of the current loop.
$loop->parent When in a nested loop, the parent's loop variable.

Comments

Popular posts from this blog

Laravel - Remove Public from URL using htaccess

  Step 1: Rename File In first step it is very easy and you need to just rename file name. you have to rename server.php to index.php at your laravel root directory. server.php INTO index.php   Step 2: Update .htaccess first of all you have to copy .htaccess file and put it laravel root folder. You just copy .htaccess file from public folder and then update bellow code: .htaccess Options -MultiViews -Indexes RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f Re...

Laravel 8: Routing Change

  In a fresh laravel 8 install, I have this in my web.php file:      Route :: get ( '/' ,  'HomeController@index' );   and this in the index method of the HomeController.php          /**      * Display a listing of the resource.      *      *  @return  \Illuminate\Http\ Response      */      public   function   index ()     {          return   view ( 'welcome' );     }     error page:--   The way to define your routes in laravel 8 or above is        use  App\Http\Controllers\ HomeController ;      / / Using PHP callable syntax...      Route :: get ( '/' , [ HomeCont...

Laravel cmd commands

php artisan --version -- check laravel version   php artisan serve    -- to start laravel php artisan route:list    -- to show all the routes as defined in web.php php artisan make:controller TestController      --  to make new controller php artisan make:controller MovieController --resource                 ->  use command to make new controller with all crud operations in it php artisan make:migration create_books_table --create=books             -->  to create new table file in database/migrate folder php artisan migrate   -->  to create tables in database of created files in migrate folder php artisan help make:migration   -->  to check all commands in maigration php artisan migrate:refresh   -->   Reset ...