title: Eager loading relationship returns empty using SELECT in WITH clause
body: <p>Using <strong>Laravel 5.4</strong>, I have a query that correctly returns a relationship. Using the "with" clause in the query, I am attempting to return only selected columns from the relationship in my controller.</p>
  
  <p>When I add the <strong>select</strong> to the <strong>with</strong> clause, relationship returns an empty array. Oddly enough, if I add a different parameter, such as a <strong>groupBy</strong> or <strong>join</strong> the query DOES return results. So something about my setup dislikes the <strong>select</strong> on the query.</p>
  
  <p>Thus far I have tried:</p>
  
  <ul>
  <li>using <strong>selectRaw</strong></li>
  <li>using <strong>select(DB::raw)</strong></li>
  <li>tried defining this as a separate relationship on my model. </li>
  </ul>
  
  <p>Nothing has worked this far. Sql log looks good when I dump it.</p>
  
  <p>Here is my model:</p>
  
  <pre><code>// MODEL
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  use DB;
  
  class ClassBlocks extends Model
  {
      public $timestamps = false;
  
      public function schedule(){
          return $this-&gt;hasMany('App\ClassSchedules', 'class_block_id', 'id');
      }
  }
  </code></pre>
  
  <p>And here is my controller:</p>
  
  <pre><code>//CONTROLLER
  use App;
  use DateTime;
  use Illuminate\Http\Request;
  
  class ProgramsController extends Controller
  {
      public function filterClass(Request $request, App\ClassBlocks $block)
      {
  
          $block = $block-&gt;newQuery();
  
          // Attempt to eager load relationship
          // Returns results when "select" disabled
          $block-&gt;with([
              'schedule' =&gt; function($query){
                  $query-&gt;select('time_start');
                  $query-&gt;groupBy('day');
              },
          ]);
  
          return $block-&gt;get();
  
      }
  }
  </code></pre>
  
  <p>Here is a sample result with select enabled (schedule returns empty):</p>
  
  <pre><code>[
    {
      "id": 13,
      "program_id": "1",
      "class_group_id": "1",
      "schedule": [
  
      ]
    }
  ]
  </code></pre>
  
  <p>And here is a result with select disabled (returns relationship when select disabled):</p>
  
  <pre><code>[
    {
      "id": 13,
      "program_id": "1",
      "class_group_id": "1",
      "schedule": [
        {
          "id": 338,
          "class_group_id": "1",
          "program_id": "1",
          "class_block_id": "13",
          "date": "06/13/2017",
          "day": "Tuesday",
          "instructor_id": "1",
          "time_start": "6:30am",
          "time_end": "6:30am"
        },
        {
          "id": 339,
          "class_group_id": "1",
          "program_id": "1",
          "class_block_id": "13",
          "date": "06/14/2017",
          "day": "Wednesday",
          "instructor_id": "2",
          "time_start": "6:30am",
          "time_end": "6:30am"
        }
      ]
    },
  ]
  </code></pre>
  
  <p>Any insight would be greatly appreciated.</p>