I have those columns in my database table :
value_day_1 | value_day_2| value_day_3 |……|value_day_36
I’m trying to display each value in a view using a for loop
@for ($n=1;$n<37;n++)
{{ $day->value_day_? }}
@endfor
How can i replace the ? by $n ?
>Solution :
One solution would be
@foreach(range(1,37) as $n)
@php($column = 'value_day_' . $n;)
{{ $day->$column }}
@endforeach
I prefer to use range instead of the for syntax but it is not neccessary for your problem