pickab00
276
13
Laravel

Count Every fourth record

Posted 3 months ago by pickab00

So I wanted to display every fourth record taken from the database. Lets say that I want to be able to show an input field for every fourth record in database. what I mean by that is, if this is the 4th record I want to show an input field in my blade. So assuming these are the records I have,

['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']

Now how can I show every 4th record. lets say '4', '8', '12' are the fourth records. And if the current record is a 4th record, I want to show an input field.

Also can I apply some other conditions like all the records which has action as 1. Where action 1, take every 4 records. Sorry I am just bad at explaining this

Please sign in or create an account to participate in this conversation.