Php 不显示表的Laravel数据库innerjoin主键

Php 不显示表的Laravel数据库innerjoin主键,php,mysql,laravel,laravel-5,laravel-eloquent,Php,Mysql,Laravel,Laravel 5,Laravel Eloquent,我无法使用javascript或基本更新进行更新,因为id相同。。你知道如何解决这个问题吗?请帮忙 我如何解决这个问题,我的控制器里有这个问题 $dataReqorder = DB::table('reqorders') ->join('productquantities', 'reqorders.item_id', '=', 'productquantities.id') ->join('products', 'productquan

我无法使用javascript或基本更新进行更新,因为id相同。。你知道如何解决这个问题吗?请帮忙

我如何解决这个问题,我的控制器里有这个问题

$dataReqorder = DB::table('reqorders')
            ->join('productquantities', 'reqorders.item_id', '=', 'productquantities.id')
            ->join('products', 'productquantities.prod_id', '=', 'products.id')
            ->where('req_id', '=', $shoppingId)
            ->get();
            dd($dataReqorder);
结果是这样的

Collection {#272 ▼
  #items: array:3 [▼
    0 => {#265 ▼
      +"id": 1
      +"req_id": "ZJXYGX42RN"
      +"item_id": "1"
      +"quantity": 100
      +"amount": "6600"
      +"status": "0"
      +"remember_token": null
      +"created_at": "2018-03-10 15:18:38"
      +"updated_at": "2018-03-11 13:03:15"
      +"prod_id": 1
      +"brand_id": 1
      +"supplier_id": 1
      +"branch_id": 3
      +"category_id": "1"
      +"price": "200"
      +"saleprice": "100"
      +"priceoption": "regular"
      +"description": "brake for yamaha"
      +"lenght": "10"
      +"width": "10"
      +"height": "10"
      +"weight": "10"
      +"unit": "piece"
      +"pic": "1520752307.png"
      +"product_name": "Brake"
    }
    1 => {#286 ▼
      +"id": 1
      +"req_id": "ZJXYGX42RN"
      +"item_id": "2"
      +"quantity": 100
      +"amount": "67000"
      +"status": "0"
      +"remember_token": null
      +"created_at": "2018-03-10 15:18:38"
      +"updated_at": "2018-03-11 13:03:15"
      +"prod_id": 1
      +"brand_id": 1
      +"supplier_id": 1
      +"branch_id": 3
      +"category_id": "1"
      +"price": "200"
      +"saleprice": "100"
      +"priceoption": "regular"
      +"description": "brake for yamaha"
      +"lenght": "10"
      +"width": "10"
      +"height": "10"
      +"weight": "10"
      +"unit": "piece"
      +"pic": "1520752614.png"
      +"product_name": "Brake"
    }
    2 => {#289 ▼
      +"id": 1
      +"req_id": "ZJXYGX42RN"
      +"item_id": "4"
      +"quantity": 33
      +"amount": "1000"
      +"status": "0"
      +"remember_token": null
      +"created_at": "2018-03-10 15:18:38"
      +"updated_at": "2018-03-11 13:03:15"
      +"prod_id": 1
      +"brand_id": 1
      +"supplier_id": 1
      +"branch_id": 3
      +"category_id": "1"
      +"price": "2"
      +"saleprice": "2"
      +"priceoption": "regular"
      +"description": "brake for yamaha"
      +"lenght": "12"
      +"width": "2"
      +"height": "2"
      +"weight": "2"
      +"unit": "roll"
      +"pic": "1520752847.png"
      +"product_name": "Brake"
    }
  ]
}

但是,我无法使用javascript或基本更新进行更新,因为id相同。。你知道如何解决这个问题吗?请帮助…

您的查询将选择所有联接表中的所有列。
如果多个列具有相同的名称(例如,
id
),则最后一列将覆盖前面的列

必须限制所选列和/或使用别名:

->get(['reqorders.*', 'products.id as products_id']);