title: Laravel return value of a specific column in a relationship
body: <p>I am extremely new to Laravel. You could help me with a small problem:
  I can not return in a collection, only the value of a specific column in a relation defined in the model. I will explain:</p>
  
  <p>I have 2 tables:</p>
  
  <p>1 - Tomos</p>
  
  <p>2 - Documents</p>
  
  <p><strong>Migrations:</strong></p>
  
  <p>1- Tomos</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>    private $table = 'tomos';
  
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create($this-&gt;table, function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('name')-&gt;nullable(false);
              $table-&gt;text('description')-&gt;nullable(true);
              $table-&gt;boolean('active')-&gt;default(true);
              $table-&gt;timestamps();
          });
      }
  </code></pre>
  
  <p>2- Documents</p>
  
  <pre class="lang-php prettyprint-override"><code>private $table = 'documents';
  
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create($this-&gt;table, function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;date('date')-&gt;nullable(false);
              $table-&gt;integer('provider_id');
              $table-&gt;integer('tomo_id');
              $table-&gt;string('folio')-&gt;nullable(false);
              $table-&gt;integer('user_id');
              $table-&gt;text('description');
              $table-&gt;timestamps();
  
              $table-&gt;foreign('provider_id')
                  -&gt;references('id')-&gt;on('providers');
  
              $table-&gt;foreign('tomo_id')
                  -&gt;references('id')-&gt;on('tomos');
  
              $table-&gt;foreign('user_id')
                  -&gt;references('id')-&gt;on('users');
          });
      }
  </code></pre>
  
  <p><strong>Relations</strong></p>
  
  <p>1- Tomo</p>
  
  <pre class="lang-php prettyprint-override"><code>public function document()
  {
      return $this-&gt;hasMany(Document::class);
  }
  </code></pre>
  
  <p>2- Document</p>
  
  <pre class="lang-php prettyprint-override"><code>public function tomo()
  {
      return $this-&gt;belongsTo(Tomo::class);
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre class="lang-php prettyprint-override"><code>class Documents extends Controller
  {
      public function read(Request $request)
      {
          $provider = $request-&gt;only('id');
  
          $documents = Document::select(['id', 'date', 'tomo_id', 'description'])
              -&gt;with([
                  'tomo' =&gt; function ($query) {
                      $query-&gt;select('id', 'name');
                  }
              ])-&gt;orderBy('date', 'ASC')
              -&gt;paginate(25);
  
          return $documents;
      }
  }
  </code></pre>
  
  <p>I'm getting the following response in JSON:</p>
  
  <pre class="lang-php prettyprint-override"><code>current_page    1
      data    […]
          0   {…}
              id  2
              date    2018-12-01
              tomo_id 1
              description 1
              tomo    {…}
                  id  1
                  name    Tomo 1
  </code></pre>
  
  <p>But ... I do not want the key ('tomo') to return an object, I want it to return the value of the column ('name') as a string. Example:</p>
  
  <pre class="lang-php prettyprint-override"><code>current_page    1
      data    […]
          0   {…}
              id  2
              date    2018-12-01
              tomo_id 1
              description 1
              tomo Tomo 1
  </code></pre>
  
  <p>Thank you very much in advance..</p>