jeudi 8 octobre 2015

Laravel 5.1 - Split content of table

I have this mysql table:

+----+-------------------------------+---------+--------------+-------------+
| id |             title             | chapter | date_release |   author    |
+----+-------------------------------+---------+--------------+-------------+
|  1 | This is should be title One   |       1 | 10/08/2015   | John Robert |
|  2 | This is should be title Two   |       1 | 11/08/2015   | John Robert |
|  3 | This is should be title Three |       1 | 12/08/2015   | John Robert |
|  4 | This is should be title Four  |       2 | 10/09/2015   | Sir Arthur  |
|  5 | This is should be title Five  |       2 | 11/09/2015   | Sir Arthur  |
|  6 | This is should be title Six   |       1 | 13/08/2015   | John Robert |
|  7 | This is should be title Seven |       2 | 12/08/2015   | Sir Arthur  |
+----+-------------------------------+---------+--------------+-------------+

In Laravel 5.1 I want to split from the table based chapter and result view like this:

<div class="chapter-1">
    <span>
    ...
    All content from table of chapter 1 only
    ...
    </span>
</div>
<div class="chapter-2">
    <span>
    ...
    All content from table of chapter 2 only
    ...
    </span>
</div>

I have no idea what query function should I do in the controller and how to display it in laravel view



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire