title: Get array of Eloquent model's relations
body: <p>I'm trying to get an array of all of my model's associations. I have the following model:</p>
  
  <pre><code>class Article extends Eloquent 
  {
      protected $guarded = array();
  
      public static $rules = array();
  
      public function author() 
      {
          return $this-&gt;belongsTo('Author');
      }
  
      public function category() 
      {
          return $this-&gt;belongsTo('Category');
      }
  }
  </code></pre>
  
  <p>From this model, I'm trying to get the following array of its relations:</p>
  
  <pre><code>array(
      'author',
      'category'
  )
  </code></pre>
  
  <p>I'm looking for a way to pull this array out from the model automatically.</p>
  
  <p>I've found <a href="http://laravel.com/api/source-class-Illuminate.Database.Eloquent.Model.html#_relationsToArray" rel="noreferrer">this</a> definition of a relationsToArray method on an Eloquent model, which appears to return an array of the model's relations. It seems to use the $this->relations attribute of the Eloquent model. However, this method returns an empty array, and the relations attribute is an empty array, despite having my relations set up correctly.</p>
  
  <p>What is $this->relations used for if not to store model relations? Is there any way that I can get an array of my model's relations automatically?</p>