title: how to use MIN and MAX sql query in Laravel Eloquent
body: <p>i want to use <code>min</code> and <code>max</code> laravel elaquent at the same line, is that posible?</p>
  
  <pre><code>Appointmentsetting::where('Day','=',1)
  -&gt;whereIn('PersonID', function ($query) {
      $query-&gt;select('p.id')
          -&gt;from('users as p')
          -&gt;join('appointmentsettings as aps', 'aps.PersonID', '=', 'p.id')
          -&gt;where('p.active', '=', 1)
          -&gt;where('aps.CompanyID', '=', 1)
          -&gt;orWhereIn('aps.PersonID', function ($query2) {
              $query2-&gt;select('cps.user_id')
                      -&gt;from('companypersonstructs as cps')
                      -&gt;where('cps.CompanyID', '=', 1);
          })
          -&gt;groupBy('aps.PersonID');
  })
  -&gt;where('active', '=', 1)
  -&gt;select(\DB::raw("SELECT MIN(StartFrom) AS StartFrom, MAX(EndTo) AS EndTo"));
  -&gt;get();
  </code></pre>
  
  <p>i got error</p>
  
  <blockquote>
    <p>SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
    error in your SQL syntax; check the manual that corresponds to your
    MariaDB server version for the right syntax to use near 'SELECT
    MIN(StartFrom) AS StartFrom, MAX(EndTo) AS EndTo from
    `appointmentsetting' at line 1</p>
  </blockquote>