title: Getting lowest price in Laravel with Eloquent
body: <p>Is there a better way to get the object with the lowest price with Laravel Eloquent? Each Product has several ticketTypes and each ticketType can have multiple prices. </p>
  
  <pre><code>    public function includeLowestPrice(Product $product)
      {
  
      $lowestPriceTicket = null;
  
      foreach ($product-&gt;ticketTypes()-&gt;hasActivePrices()-&gt;get() as $type) {
          foreach ($type-&gt;prices()-&gt;get() as $ticketPrice) {
              if (!$lowestPriceTicket || $ticketPrice-&gt;value &lt; $lowestPriceTicket-&gt;value) {
                  $lowestPriceTicket = $ticketPrice;
              }
          }
      }
  
      return $lowestPriceTicket ? $this-&gt;item($lowestPriceTicket, new TicketPriceTransformer()) : null;
      }
  </code></pre>