title: Laravel + Eloquent ORM: HasManyThrough OrderBy TableC.column2
body: <blockquote>
    <p>Table A = Inventory | Table B = ItemAssociation | Table C = ItemValue</p>
  </blockquote>
  
  <p>I have Table A, B and C. A and B have a one-to-one relationship, B and C have a one to one relationship. I'm currently using the HasManyThrough relationship to arrive at this:</p>
  
  <pre><code>public function item(){
      return $this-&gt;hasManyThrough('App\ItemValue','App\ItemAssociation','id','id');
  }
  </code></pre>
  
  <p>And in my controller:</p>
  
  <pre><code>public function orm(){
      $inventory = Inventory::getAssocBySteamID(76561198124900864)-&gt;get();
      $i = 0;
      foreach($inventory as $inv){
          $this-&gt;data[$i] = $inv-&gt;item()-&gt;get();
          $i++;
      }
      return $this-&gt;data;
  }
  </code></pre>
  
  <p>Where Inventory::getAssocBySteamID:</p>
  
  <pre><code>public static function getAssocBySteamID($id){
      return SELF::where('steamid64','=',$id);
  }
  </code></pre>
  
  <p>This returns all the data I need, however, I need to order this by a column in Table C, the ItemValue model.</p>
  
  <p>Any help would be greatly appreciated.</p>