jeudi 2 novembre 2017

Using pagination with foreach roop in Laravel

Below code include roop statement and pagination. I'm also wish to follow MVC style coding, but in this case I have to use @if statement in below view.

There was an error when I tried to filter by @if(!deleted_at == null), but I couldn't show correct pagination, because also this code counting with "(deleted_at == null)", so result was incorrect pagination numbers shown.

How could I modify this code for get the correct pagination result? Thanks:)

<tbody>
@foreach($jobs as $job)
    @if(!$job->deleted_at == null)
    <tr>
        <td>{!! $job->id !!}</td>
        <td>{!! $job->user_name !!}</td>
        <td>{!! $job->created_at !!}</td>
        <td>{!! $job->deleted_at !!}</td>
        <td>{!! $job->usedTime() !!}</td>
    </tr>
    @endif
@endforeach
</tbody>
</table>
</div>




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

Aucun commentaire:

Enregistrer un commentaire