vendredi 27 avril 2018

Laravel 5 get data based on foreach loop

I have this view:

<table class="table table-bordered table-hover">
  <thead>
    <th>Device</th>
    <th>Maintenance History</th>
    <th>Jan</th>
    <th>Feb</th>
    <th>Mar</th>
    <th>Apr</th>
  </thead>
  @foreach($devices as $value)
  <tbody>
    <tr>
      <td></td>
      <td>
        /* I need to loop from the maintenance history table based on device ID, for example the result like this
        - Catridge
        - Printer Heads */
      </td>
      <td>
        /* also I need to loop the maintenance costs (maintenance history table) based on the month column and device ID, for example the result like this
        - 2500
        - 7350 */
      </td>
      <td>// same with above</td>
      <td>// same with above</td>
      <td>// same with above</td>
    </tr>
  </tbody>
  @endforeach
</table>

FYI I already have 2 table in the database (devices, maintenance_history). Please anyone, any idea how to solve this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire