Skip to content
Advertisement

Addition of an ordinal number in the Laravel Model

I am beginner webdeveloper, I use in my project Laravel 7 and maatwebsite/excel

I have this code:

JavaScript

This code generates an Excel document. It works fine. I would like to add a sequence number in 1 column (1,2,3 etc).

How can I do this?

My model:

JavaScript

Please help

Advertisement

Answer

try this

basically u need to add sn to heading then in your collection u need to a new key sn with calculated sequence number

hope it will work if not please tell me what error u r getting

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