'decrease ratio 2 value as user select and increase as user select option another

<?php                                                
  @foreach($betOptions as $data)

    <div class="progress-button-item sport-table-wager-button m-0">
      <a class="bet_button text-decoration-none"
         href="#0" 
         data-toggle="modal"
         data-target="#sportModal"
         data-team-name="{{$data->option_name}}"
         data-confrontation="{{$question->match->name}}" 
         data-id="{{$data->id}}"
         data-minamo="{{$data->min_amo}}"
         data-macthid="{{$question->match->id}}"
         data-ratioone="{{$data->ratio1}}" 
         data-ratiotwo="{{$data->ratio2}}" 
         data-betlimit="{{$data->bet_limit}}" 
         data-questionid="{{$question->id}}"
         data-wager-count="{{$data->ratio1}} : {{$data->ratio2}}">
        <span>{{$data->option_name}}</span>
        <span class="sport-table-wager-button-count">
          {{$data->ratio1}} : {{$data->ratio2}}</span>
      </a>

      @php
        $percent = percent($data->totalInvestByOptions(), $question->totalInvest())
      @endphp

      <div class="progress">
        <div class="progress-bar progress-bar-striped bg-success" 
             role="progressbar" 
             style="width: {{$percent}}%;"
             aria-valuenow="{{$percent}}"
             aria-valuemin="0"
             aria-valuemax="100">{{$percent}}%</div>
      </div>
    </div>


  @endforeach

  ?>

I want when user select any option 1 then it's ratio 2 value decrease and increase other options ratio 2 value. And when user select option 2 it's ratio 2 value decrease and other optio ns ratio 2 value increase



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source