title: Include model relationships in json response using Eloquent and Laravel 5
body: <p>I have a Model setup as so:</p>
  
  <pre><code>&lt;?php namespace App\Models;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Upload extends Model {
  
      /**
       * The database table used by the model.
       *
       * @var string
       */
      protected $table = 'uploads';
  
      /**
       * The attributes excluded from the model's JSON form.
       *
       * @var array
       */
      protected $hidden = array('id', 'user', 'created_at', 'updated_at');
  
      public function mime() {
          return $this-&gt;hasOne('App\Models\Mime', 'mime');
      }
  }
  </code></pre>
  
  <p>And when <code>JsonSerialize()</code> is called, it returns:</p>
  
  <pre><code>{
      "serverPath": "upload/2015/06/06/21/filename.jpg",
      "filename": "filename.jpg",
      "mime": "92"
  }
  </code></pre>
  
  <p>This <code>92</code> references the id in another table (which <code>App\Models\Mime</code> represents) with a string, <code>type</code>, associated with it. I would like to replace this <code>92</code> with said string.</p>
  
  <pre><code>{
      "serverPath": "upload/2015/06/06/21/filename.jpg",
      "filename": "filename.jpg",
      "mime": "image/jpeg"
  }
  </code></pre>
  
  <p>How is this possible? I tried some stuff with <code>protected $appends</code> in the <code>Upload</code> model, but I'm not sure I fully understand how to use/access relationships from within the model.</p>
  
  <p><strong>Clarification</strong> The table <em>mimes</em> contains columns <code>id</code> and <code>type</code>, while table <em>uploads</em> contains an integer column called <code>mime</code> that references an id in <em>mimes</em></p>