title: Laravel belongs to many by two intermediate tables?
body: <p>Hi guys I have to create many to many relationship but through a another table. but laravel <code>BelongsToMany</code> give only 1 intermediate table relation
  here table structure:</p>
  <pre><code>features Table:
  +----+-----------+
  | id | text      |
  +----+-----------+
  | 1  | feature 1 |
  +----+-----------+
  | 2  | feature 2 |
  +----+-----------+
  
  feature_values table:
  +----+-----------+-------+
  | id | feature_id | text  |
  +----+-----------+-------+
  | 1  | 1          | val 1 |
  +----+-----------+-------+
  | 2  | 1          | val 2 |
  +----+-----------+-------+
  | 3  | 2          | val 3 |
  +----+-----------+-------+
  
  products table: 
  +----+-------+
  | id | name  |
  +----+-------+
  | 1  | tv    |
  +----+-------+
  | 2  | phone |
  +----+-------+
  
  product_features table:
  +----+------------+------------+
  | id | product_id | feature_id |
  +----+------------+------------+
  | 1  | 1          | 1          |
  +----+------------+------------+
  | 2  | 2          | 1          |
  +----+------------+------------+
  | 3  | 2          | 2          |
  +----+------------+------------+
  
  product_feature_values table:
  
  +----+--------------------+------------------+
  | id | product_feature_id | feature_value_id |
  +----+--------------------+------------------+
  | 1  | 1                  | 1                |
  +----+--------------------+------------------+
  | 2  | 2                  | 1                |
  +----+--------------------+------------------+
  | 3  | 2                  | 2                |
  +----+--------------------+------------------+
  </code></pre>
  <p><strong>I'm trying to create a relationship between <code>feature_values</code> and and <code>products</code> through <code>product_feature_values</code> and <code>product_features</code> for get <code>product</code> by <code>feature_values</code>.</strong></p>
  <p>I know data can obtain by joining tables, but I looking for a solution that using by laravel model relationships</p>
  <p>thank you.</p>
  <p>I tried like this</p>
  <pre><code>class FeatureValue extends Model
  {
     
      public function products()
      {
          return  $this-&gt;belongsToMany(Product::class,'product_feature_values')-&gt;withTimestamps();
      }
  
  }
  </code></pre>