Laravel 中 JOIN 后的 2 id 列。如何访问Controller和Blade中的两个ID?

2 id column after JOIN in Laravel. How to access to both IDs in Controller and Blade?

加入后我得到了 table 和 2 个 ID 列。现在我不知道如何在 Controller 和 Blade 中访问这两个 ID。

在 Blade 中,当我尝试 {{$value->id}} 时它获得了第二个 ID。

$users = User::where('user_id', $user_id)
->join('tagged', 'tagged.taggable_id', '=', 'users.id')
->orderBy('users.id', 'asc')
->get();

给我:

-------------------------------------------------------
| id | name| phone | id | taggable_type | taggable_id |
-------------------------------------------------------

如何在 Controller 和 Blade 中获取两个 ID?

  $users = DB::table('users')->where('user_id','=', $user_id)
  ->select('users.*','tagged.id as tagged_id') //add fields required from tagged table in this row
  ->join('tagged', 'tagged.taggable_id', '=', 'users.id')
  ->orderBy('users.id', 'asc')
  ->get();

  Use $users->tagged_id and $users->id in view