rickyreza12's avatar

Help me solve this case about index foreach :(

This is the code that i have

 <td>{{$key}}</td>
                    <td>
                    @if(strpos(($break-1)->BREAK_ITALY, 'BREAK') !== false)
                    <select class="form-control">
                        <option value="{{$breaks->BREAK_ITALY}}">BREAK</option>
                        <option value=""></option>
                    </select>
                    @else
                        @if(strpos($breaks->BREAK_ITALY, 'BREAK') == true && ($breaks)->BREAK_ITALY === null)
                            <select class="form-control">
                                <option value="BREAK">BREAK</option>
                            <option value=""></option>
                        </select>
                        @else
                        <select class="form-control">
                            <option value=""></option>
                            <option value="BREAK">BREAK</option>
                        </select>
                        @endif
                    @endif

what i want is getting value row from before and after like

$examplearray[index-1] or $examplearray[index++] 

and this is the example question of the images when the data in database https://imgur.com/1uyImDH

and this is what i want the data to be showing https://imgur.com/1Kh9M2G

how can i do that??

0 likes
4 replies
Sinnbeck's avatar

I don't see any loops? What index? Is there a foreach you forgot to post?

jlrdw's avatar

You also need a name for your select.

rickyreza12's avatar

it's i tried to make but i had a dificulity on the table

jlrdw's avatar

You have to get the data in the request, you can use either

dd($request->all());

// or

echo $request->input('your_select_name');  // give it a name
die;

To make sure you are receiving the request.

Or use the network tab. You need to troubleshoot one step at a time.

Please or to participate in this conversation.