title: Getting just the minimum value on a joined table with Eloquent
body: <p>I have 2 tables, <code>subscriptions</code> and <code>subscription_options</code> like so.</p>
  
  <pre><code>subscriptions
  ------------------------
  id    |subscription_name
  ------------------------
  1     |silver
  2     |gold
  
  
  ----------------------------------------------------
  subscription_options
  ----------------------------------------------------
  id    |subscription_id   |price   |duration (months)
  1     |1                 |10      |3
  2     |1                 |20      |6
  3     |2                 |40      |3
  4     |2                 |50      |6
  </code></pre>
  
  <p><code>subscriptions</code> have a one to many relationship with <code>subscription_options</code></p>
  
  <pre><code>// Subscription model
  public function options() {
  
      return $this-&gt;hasMany('App\SubscriptionOption', 'subscription_id');
  }
  </code></pre>
  
  <p>I would like to get the cheapest price for both of my subscription, so i should get 2 rows with <code>subscription_options</code>.<code>id</code> of <code>1</code> and <code>3</code> along with all of their columns. How would i do it with laravel eloquent?</p>
  
  <p>These are the things that i have tried, they either gave me an error or return something close to what i am looking for</p>
  
  <pre><code>Subscription::with('options')-&gt;min('price')-&gt;get();
  
  
  Subscription::with(['options' =&gt; function($query) {
           $query-&gt;min('price');
       }])-&gt;get();
  </code></pre>