Skip to content
Advertisement

How to automatically number each row in a table in laravel?

Please I want to automatically number each row when data is displayed from the database. Something like this

JavaScript

so each row is numbered in ascending order from 1 to n depending on the data available in the database. How do I properly do that. Any Help please am new in laravel

Advertisement

Answer

If you are using blade, the laravel’s automatically generated $loop variable might help. Like this:

JavaScript

You can find documentation here: https://laravel.com/docs/8.x/blade#the-loop-variable

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement