title: i want to display the product_name from the other table that has the same product_id laravel
body: <p>Controller: </p>
  
  <pre><code>public function OrderHistory(){
  
      $user_id = Auth::User()-&gt;id;
      $orders = Order::with('ordersz')-&gt;where('user_id',$user_id)-&gt;get();
      return view('users.order_history')-&gt;with(compact('orders'));
  }
  </code></pre>
  
  <p><strong>Blade page:</strong></p>
  
  <pre><code>&lt;table id="example" class="table table-striped table-bordered" style="width:100%;"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Order ID&lt;/th&gt;
              {{--&lt;th&gt;Quantity&lt;/th&gt;--}}
              &lt;th&gt;Ordered Products&lt;/th&gt;
              &lt;th&gt; Quantity&lt;/th&gt;
              &lt;th&gt;Total&lt;/th&gt;
              &lt;th&gt;Order Date&lt;/th&gt;
              &lt;th&gt;Actions&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          @foreach($orders as $order)
              &lt;tr&gt;
                  &lt;td&gt;{{$order-&gt;id}}&lt;/td&gt;
                  &lt;td&gt;
                      {{--@foreach($userCart as $cart)--}}
                          {{--{{$cart-&gt;product_name}}&lt;br&gt;--}}
                      {{--@endforeach--}}
  
                      @foreach($order-&gt;ordersz as $pro)
                          {{$pro-&gt;product_id}}&lt;br&gt;// here im displaying the product_id but i want the product name
                      @endforeach
                  &lt;/td&gt;
                  &lt;td&gt;
                      {{--@foreach($userCart as $cart)--}}
                      {{--{{$cart-&gt;product_name}}&lt;br&gt;--}}
                      {{--@endforeach--}}
  
                      @foreach($order-&gt;ordersz as $pro)
                          {{$pro-&gt;quantity}}&lt;br&gt;
                      @endforeach
                  &lt;/td&gt;
                  &lt;td&gt; {{$order-&gt;total_amount}}&lt;/td&gt;
                  &lt;td&gt; {{$order-&gt;created_at}}&lt;/td&gt;
                  &lt;td&gt;View Details&lt;/td&gt;
  
              &lt;/tr&gt;
          @endforeach
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I'm getting the orders history by <code>user id</code> and I'm displaying the <strong>product_id</strong> in the <strong>orders_product table</strong>. Now I want to display the <strong>product_name</strong> from <strong>products table</strong>, I have foreign key for <strong>products_id</strong></p>