mardi 3 décembre 2019

laravel db query paginate get row ids in blade

Hello I'm using db query in my controller

$query = DB::table('users');
$records = $query->paginate(50);

in view I access the records as

@foreach ($records as $row)
 <tr>
   <td></td>
   <td></td>
   <td></td>
 </tr>  
@endforeach

now the name and email are all correct except for the id it only generates 1

example:

-------------------------
1 | name1 | email1
-------------------------
1 | name2 | name2
------------------------
1 | name3 | name 3

i don't know why it's only showing up 1 in the id when the var_dump(DB::getQueryLog()); shows the correct ids 1, 2, 3

note: this is a large database around 500k records it could show 200231 as the ID

I'm using Laravel Framework 5.8.35



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire