I want to create a dynamic function/method base on number of data I retrieved in my database, the reason why I need to create a dynamic function/method is I have a button inside of a foreach.
When that button click, it will add another row on that data
Below is my controller
Controller
Variable items is my data that I retrieved in my database, now I used foreach to create a dynamic variable
View
As you can see in the photo above, this is the name of the click event. “items_0” etc.
Now my question is, how do I create a dynamic method inside of this?