dimanche 3 janvier 2016

Laravel 5 how use pagination with files list?

I have one problem with my script. I did foreach with files list but I need pagination, for example 15 files per site. What should I do now? Thanks for help :)

Controller:

$files = Storage::allFiles('/upload_file');

return view('cms.viewSystem.gallery.manageFiles')->with('files', $files);

Blade view:

<table class="table table-bordered table-striped datatable" id="table-2">
                <thead>
                    <tr>
                        <th>Nazwa pliku</th>
                        <th>Akcje</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($files as $file)
                        <tr>
                            <td>{{ $file }}</td>
                            <td>
                                <a href="{{ url('cms/media/deleteFile/'.$file) }}" class="btn btn-red btn-sm btn-icon icon-left"><i class="entypo-cancel"></i>Usuń</a>
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>

I tried use paginate() but this option not working :(



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire