Support the ongoing development of Laravel.io →
Requests Database

Hi , everyone.

$sql = "SELECT *,earth_distance(ll_to_earth(team.lat, team.lng), ll_to_earth(23.1215939329,113.3096030895)) AS distance FROM team where earth_box(ll_to_earth(23.1215939329,113.3096030895),1000) @> ll_to_earth(team.lat, team.lng); ";
$result = DB::select( \DB::raw( $sql ) );

This is my Controller code, My question is , how can i use Pagination add into this code to build my restful api ?

The second question , iOS or android will send the "next page" parameter , how to use it and find the next section data ?

If you know how to do it or any open resource in use , please tell me , thanks!!!

Last updated 3 years ago.
0

Think of Creating A Paginator Manually when using raw SQL.

Another related useful resources on Stackoverflow:

Some API centric Github relevant repositories:

Last updated 10 years ago.
0

See this thread, has another paginator example ===http://laravel.io/forum/11-13-2014-laravel-5-pagination

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ykenny ykenny Joined 21 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.