title: How addSelect() Builder method works in Laravel
body: <p>Say I have these models: </p>
  
  <p><strong>User Model</strong></p>
  
  <pre><code>namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class User extends Model
  {
      /**
       * The table associated with the model.
       *
       * @var string
       */
      protected $table = 'User';
  
      protected $fillable =
      [
         'username', 'favoriteColor'
      ];          
  
      public function flights()
      {
          return $this-&gt;hasMany('App\Flight');
      }
  }
  </code></pre>
  
  <p><strong>Flight Model</strong></p>
  
  <pre><code>namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Flight extends Model
  {
      /**
       * The table associated with the model.
       *
       * @var string
       */
      protected $table = 'Flight';
  
      protected $fillable =
      [
         'flightName', 
      ];              
  }   
  </code></pre>
  
  <p>I'm trying to do something with eager loading, whenever I do this:</p>
  
  <pre><code>$usersWithFlights = User::with(['flights'])-&gt;get();
  </code></pre>
  
  <p>I get data like this: (Which if fine, is what I expect)</p>
  
  <pre><code>{
      "userID": 1,
      "favoriteColor": green
      "flights": 
      [
         {
             "flightID": 2240,
             "flightName" : "To Beijing fellas"
         },
         {
             "flightID": 4432,
             "flightName" : "To Russia fellas"
         },       
      ]
  }
  </code></pre>
  
  <p>But then I want to add a column using a select raw like this: (Don't think about how silly the <code>1 as number</code> is, it's just for the sake of the example.</p>
  
  <pre><code>$usersWithFlights = User::with(['flights'])-&gt;addSelect(DB::raw('1 as number'))-&gt;get();
  </code></pre>
  
  <p>I get the data like this:</p>
  
  <pre><code>[
      {
          "userID": 1,
          "favoriteColor": green
          "flights": []
      }
  ]
  </code></pre>
  
  <p><strong>QUESTION</strong></p>
  
  <p>Was the addSelect() method made for this kind of behaviour? If not are other work arounds in order to achieve this? </p>
  
  <p><strong>NOTE</strong></p>
  
  <p>I know I could add in the select method something like <code>Flights.*, Users.*</code> but I want to know if the addSelect method works that way</p>