title: Select specific columns from Eloquent relations
body: <p>I have the following models in my application:</p>
  <p><strong>User.php</strong></p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Models;
  
  use Illuminate\Database\Eloquent\Model;
  
  class User extends Model
  {
      public function customer_details()
      {
          return $this-&gt;hasOne(CustomerDetails::class);
      }
  }
  </code></pre>
  <p><strong>CustomerDetails.php</strong></p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Models;
  
  use Illuminate\Database\Eloquent\Model;
  
  class CustomerDetails extends Model
  {
      public function user()
      {
          return $this-&gt;belongsTo(User::class);
      }
  }
  </code></pre>
  <p>Now I am trying to run the following query:</p>
  <pre class="lang-php prettyprint-override"><code>$user = User::select('email', 'phone')
      -&gt;where('id', Auth::user()-&gt;id)
      -&gt;with('customer_details')
      -&gt;first();
  </code></pre>
  <p>Now what I want it to do is to select only the <strong>email</strong> and <strong>phone</strong> number from my <strong>users</strong> table and <strong>first_name</strong>, <strong>last_name</strong> from my <strong>customer_details</strong> table but whenever I try this it always returns <strong>customer_details</strong> as <code>null</code>.</p>