jeudi 28 avril 2022

How to get array values using foreach in laravel

I am new to laravel and php. I have this code in one of my controllers

$group_by_precedence = array("true", "false");

and this code in the view

@foreach  ($group_by_precedence as $value)

                    <thead>
                        <tr>
                            <th colspan="8">
                                <a class="collapse-button collapsed" data-toggle="collapse" href="#collapse_&&&&&" aria-expanded="true" aria-controls="collapse_&&&&&" onclick = "loadDealsFor(&&&&&, 'precedence');"  style="width: 100%;display: block;margin: -10px;padding: 10px;">
                                    <i class="zmdi zmdi-plus"></i> <i class="zmdi zmdi-minus"></i> exists
                                </a>
                            </th>
                        </tr>
                    </thead>
                    
                @endforeach 

I tried and not managed to know how to make the code in the view to be duplicated twice, and replace the &&&&& with the values from the $group_by_precedence array, first the true and second the false. currently the bad solution is to duplicate the code in the view, and just change the &&&&& true and false. can someone assist?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/C4o0OU1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire