I'am using the Halo 5 API, and I'm trying to get a players total Progress till their next rank. In order to do that, one of the steps is I have to get a players next rank. From there on I can get the start Xp of that rank.
I know how to get a players current rank with its Start XP. What I cant figure out is how to get the next rank ( or row ) from the database.
This is how my function is set up right now:
public function currentProgressRank($playerArenaStats) {
// Get a players current xp and rank from API JSON array
$PlayersRankXP = $playerArenaStats->Results[0]->Result->Xp;
$PlayersRank = $playerArenaStats->Results[0]->Result->SpartanRank;
// Get a Players current Rank from Database by comparing a players rank from API to a rank ID from Database
$GetStartXp = Ranks::where('rank_id', '=', $PlayersRank)->get();
// Do a foreach loop, and get the start XP into the current rank
foreach ($GetStartXp as $XP) {
$GetStart = $XP->startXp;
}
// Need to get Start Xp for the Players next rank here....
}
I know there is the next() method, but how would I implement that into a laravel eloquent search