Linda Harden
Linda Harden

Reputation: 1

Paginate not showing all data

My paginate function is not working correctly for one set of data. The data is just disappearing after the set number of paginate. When I go to the correct url and enter page 2 it will appear but not giving me the option of switching pages at the bottom of the web page like it should.

I have used the same good from the one I have working but it does not seem to do the job.

    $vulnerabilitys = Vulnerability::orderBy('risk', 'asc')->paginate(6);
    return view('vulnerabilities.index')>with('vulnerabilitys',$vulnerabilitys);

I expect the result to give me the option to change to the next page at the bottom of the data, by having a page 1/2/3 etc.

Upvotes: 0

Views: 529

Answers (2)

Linda Harden
Linda Harden

Reputation: 1

@if(count($vulnerabilitys)>0) @foreach ($vulnerabilitys as $vulnerability) <div class = "well"> <h3><a href="/vulnerabilities/{{$vulnerability->id}}">{{$vulnerability->risk}}</a></h3> <small>{{$vulnerability->description}}</small> </div> @endforeach {{$vulnerabilitys->links()}}

Upvotes: 0

Loko
Loko

Reputation: 195

Did you add {{ $vulnerabilitys->links() }} to your view?

See Laravel Pagination

Upvotes: 1

Related Questions