I have the following query to return the $steps :
$steps = Step::where('g_id', $id)->get();
return view('showg', ['step' => $steps]);
The results are a group of objects looped in a foreach. I'm trying to add a rank to each step, which will show the number of the step. It should simply start from one until the end of the steps.
Is there an easy way instead of creating a step_number column for this purpose ?
@foreach ($step as $steps)
<div>{{ $steps->step_number }}</div>
<div>{{ $steps->step }}</div>
@endforeach
$loop->iterationlaravel.com/docs/7.x/blade#the-loop-variable