$projects=Project::orderBy('lift_at', 'desc')
->get()
->map(function ($item, $index) {
$item['rank'] = $index + 1;
return $item->update(['rank']);
});
DB::update('update users set votes = 100 where name = ?', ['John']);
UPDATE tbl, (select @cnt:=0) as cnt SET rank=(@cnt:=@cnt+1)