lundi 19 juin 2017

Pagination Laravel Problems

I want to do pagination on my search result, first of all i go to laravel documentation and find:

$users = User::where('votes', '>', 100)->paginate(15);

And for output:

<div class="container">
 @foreach ($users as $user)
    
 @endforeach
</div>



It's easy and simple, BUT i have in my View:

<ul class="pagination"> <!-- Previous Page Link --> <li class="disabled">
<span>&laquo;</span></li> <!-- Pagination Elements --> <!-- "Three Dots" 
Separator --> <!-- Array Of Links --> <li class="active"><span>1</span>
</li> <li><a href="http://ddrivers/search?page=2">2</a></li> <li><a 
href="http://ddrivers/search?page=3">3</a></li> <li><a 
href="http://ddrivers/search?page=4">4</a></li> <li><a 
href="http://ddrivers/search?page=5">5</a></li> <li><a 
href="http://ddrivers/search?page=6">6</a></li> <li><a 
href="http://ddrivers/search?page=7">7</a></li> <li><a 
href="http://ddrivers/search?page=8">8</a></li> <!-- "Three Dots" 
Separator --> <li class="disabled"><span>...</span></li> <!-- Array Of 
Links --> <!-- "Three Dots" Separator --> <!-- Array Of Links --> <li><a href="http://ddrivers/search?page=923">923</a></li> <li><a href="http://ddrivers/search?page=924">924</a></li> <!-- Next Page Link --> <li><a href="http://ddrivers/search?page=2" rel="next">&raquo;</a></li> </ul>

Where pagination sould be, first of all i connect bootstrap to my project(doesent help). How can i fix it?

View:

<tbody>
                

                </tbody>
            </table><!-- end table -->
        </div>

    </form>

    

Controller:

public function search() {
    $request = Request::all();
    $name = $request['name'];
    $result = Driver::where('vendor', $name)->paginate(25);
    return view('driver_search', [
        '_keywords' => $name ?: '',
        'query' => request('name'),
        'result' => $result,

    ]);
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire