dimanche 1 mai 2016

How to add Pagination in laravel 5

I need to show one row per page. this my contoller class code

public function showcontent($id)
{
    $story=storybook::find($id);
    $content=storycontent::where('titleid', $story['id'])->paginate(1);
    //return $content;
    return view('storyBook/viewStory',compact('story','content'));
}

this my view class code

 @foreach($content as $content)
            <?php $a=null; ?>
            <?php $b=null; ?>

                <?php $a=$content->file1; ?>
                <?php $b=$content->file2; ?>

            <table style="height: 330px;width: 680px;margin-top: 120px;margin-left: 50px">
                <tr>
                    <td style="width: 340px"><img src="/" alt="Mountain View" style="width:330px;height:300px;"></td>
                    <td style="width: 340px"><img src="/" alt="Mountain View" style="width:330px;height:300px;"></td>
                </tr>
            </table>
            <br>
        @endforeach

In here i get only 1st row, rest of the rows not visible.. I do not know how to add pagination.



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

Aucun commentaire:

Enregistrer un commentaire