Answers for "laravel db table pagination"

SQL
2

laravel paginate raw sql

$items = DB::table('team')   
    ->selectRaw('SELECT *,earth_distance(ll_to_earth(team.lat, team.lng), ll_to_earth(23.1215939329,113.3096030895)) AS distance')
    ->whereRaw('earth_box(ll_to_earth(23.1215939329,113.3096030895),1000) @> ll_to_earth(team.lat, team.lng)')
    ->paginate(10);

foreach($items as $item) {
    echo $item->distance;
}
Posted by: Guest on May-29-2020
3

paginate relationship laravel7

$category = Category::first();
$apps = $category->apps()->paginate(10);
return view('example', compact('category', 'apps'));
Posted by: Guest on July-11-2020
2

paginate relationship laravel7

@foreach ($apps as $app)
    {{ $app->id }}
@endforeach

{!! $apps->render() !!}
Posted by: Guest on July-11-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language