0👍
Assuming you have followed Laravel conventions when setting up model relations, getOrdersProducts
method in your controller should look something like:
public function getOrdersProducts(Order $order)
{
return $order->load('products');
}
Which makes it possible to access the list of products for the particular order with:
$order->products
Source:stackexchange.com