title: Getting data from mutliple tables casuing duplicated data in view
body: <p>i am trying to display data from two different tables</p>
  <p>Controller:</p>
  <pre><code>public function index()
  {
      $order = DB::table('order')-&gt;get();
      $order_item = DB::table('order_item')-&gt;get();
      return view('admin.orders', compact('order','order_item'));
  }
  </code></pre>
  <p>View:</p>
  <pre><code>           @foreach ($order as $orders)
             @foreach ($order_item as $order_items)
             &lt;tr&gt;
              &lt;th style=&quot;padding: 20px&quot;&gt;{{ $orders-&gt;id }}&lt;/th&gt;
              &lt;th style=&quot;padding: 20px&quot;&gt;{{ $order_items-&gt;order_id }}&lt;/th&gt;
  
              &lt;th style=&quot;padding: 20px&quot;&gt;&amp;nbsp;&lt;a&gt;&lt;i style=&quot;color: #6565D8&quot;
                  class=&quot;fa-solid fa-location-dot&quot;&gt;&lt;/i&gt;&lt;/a&gt;&amp;nbsp;
              &amp;nbsp;&lt;a&gt;&lt;i style=&quot;color: #6565D8&quot; class=&quot;fa-solid fa-eye&quot;&gt;&lt;/i&gt;&lt;/a&gt;&amp;nbsp;
              &amp;nbsp;&lt;a&gt;&lt;i style=&quot;color: #6565D8&quot; class=&quot;fa-solid fa-eye&quot;&gt;&lt;/i&gt;&lt;/a&gt;&amp;nbsp;
              &lt;/th&gt;
             &lt;/tr&gt;
             @endforeach
             @endforeach
  </code></pre>
  <p>the problem in &quot;$orders-&gt;id&quot; it duplicate data to fulfill the same rows from the other table i am getting the same data (no duplicate) from &quot;$order_items-&gt;order_id&quot;</p>
  <p>how to stop solve this issue?</p>
  <p><a href="https://i.stack.imgur.com/GJsKY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GJsKY.png" alt="enter image description here" /></a></p>