dimanche 28 août 2016

make table with foreach and for work in same time

here I would like to make a table where there number of rows will automatically be made in accordance with the data in $ kosts-> stock_room. and then there is also I want to make the data directly arranged with the data I have on the table residents by room number, so if i have data in table 'residents' with room number 10 its will fill the table with row 10.

here my code :

<table class="table table-hover table-striped">
        <tr>
            <th width="10%">Action</th>
            <th>Room</th>
            <th>Kost</th>
            <th>Name</th>
            <th>Due Date</th>
        </tr>        
        <tr>
            @foreach($posts as $row)
            @for($i=1;$i<=$kosts->stock_room;$i++) 
            <tr>
            <td>                
            <a title='Edit Data' class='btn btn-xs btn-warning' href=''><i class='fa fa-pencil'></i></a>
            <a title='Delete Data' class='btn btn-xs btn-danger' href='' onclick="return confirm('sure to delete ?')"><i class='fa fa-trash'></i></a>                      
            </td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            </tr>   
            @endfor
            @endforeach
        </tr>
    </table>

have someone can help me, to make my code can work exactly like I want?

and iam sorry for my bad english



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ckLkLK
via IFTTT

Aucun commentaire:

Enregistrer un commentaire