如何在id字段的单击复选框上汇总价格并传递给控制器​​并在laravel的文本框中查看

In my app i want to pass the id one by one form view to controller using jquery and sum there value

and print in view

how can i do that any body help

expected result is 25 not 13 in total price

this is the view

http://prntscr.com/nam2nb

this is my controller

public function price_count(Request $request)
    {
        $total_parice  = DB::table('tms_store')
                ->where('product_id', $request->id)
                ->select(DB::raw('sum(product_price) as total_amount'))
                ->first();
        Session::put('price', $total_parice);
        $price = Session::get('price');

        return response()->json($price);
    }

this is jquery

function total_amount(id) 
{
   var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');
    $.ajax({
        url: APP_URL+"/driver-equipment/price",
        type: 'POST',
        dataType: 'json',
        data: {_token: CSRF_TOKEN,'id' : id},
    })
    .done(function(res) {
        console.log(res)
        $("#totalPrice").val(res.total_amount);
    })
    .fail(function() {
        console.log("error");
    })

}

You can just do this :

$total_amount = DB::table('tms_store')
                ->where('product_id', $request->id)->sum('product_price');