Nevermind, I was able to solve this using the following:
class OrderItem extends Model
{
public function orders()
{
return $this->belongsTo('Order');
}
public function products()
{
return $this->component->belongsToMany('App\Models\Product\Product');
}
public function component()
{
return $this->hasOne('App\Models\Product\Component');
}
}
Controller:
$order = Order::with(array('items' => function($query)
{
$query->with('products')
->join('product_components AS c', 'c.id', '=', 'product_order_items.component_id') ;
}))
->find($id);
View:
<h3>Order Id : {{ $order->id }} </h3>
<h3>Order Date : {{ $order->order_date }} </h3>
@foreach($order->items as $item)
<tr>
<td>{{ $item->component_name }}</td>
<td>{{ $item->component_price }}
@foreach($item->products AS $product)
<li>{{ $product->name }}</li>
@endforeach
</td>
</tr>
@endforeach