Laravel - Get Pivot Table Relationship
<p>I have four tables: characters, pets, characters_pets and characters_pets_metadata.
A character has many pets on the pivot table characters_pets, but I also need to get the data from the metadata table:</p>

<pre><code>class Character extends Model {

    protected $table = 'characters';

    public function pets() {
        return $this-&gt;belongsToMany('Pet', 'characters_pets');
    }
}



class CharacterPet extends Model {

    protected $table = 'characters_pets';

    public function metadata() {
        return $this-&gt;hasMany('PetMetadata');
    }

}
</code></pre>

<p>How can I fetch the metadata for each character pet through a relationship?</p>