$credits = User::select('id','username')->where('id', auth()->id())
->with(['game_credits' => function($query) use ($phase){
$query->select('user_id','no_of_game_played','game_credits')
->where('phase_id', $phase->id);
}])->first();
Here I want to return game_credits-no_of_game_played
which will give me the remaining credits, How can I do that inside whereHas? Here, USER HAS MANY GAME CREDITS