title: How to get an attribute throw a table in Eloquent?
body: <p>I have requests table that belongs to subcategories table which belongs to categories table, so from Request model how can I get an attribute from categories?</p>
  <pre><code>tables
  
  -&gt;requests
  id
  name
  subcategory_id
  
  
  -&gt;subcategories
  id
  name
  category_id
  
  
  -&gt;categories
  id
  name
  color
  </code></pre>
  <p>So I need to get color from Request model, I already have the tree models created</p>
  <pre><code>class Request extends Model
  {
      public function user()
      {
          return $this-&gt;belongsTo(User::class)-&gt;get();
      }
  
      public function color()
      {
          $somemagicstuff;
          
          return $color;
      }
  }
  </code></pre>