title: One table with multiple pivots tables
body: <p>these are relations in my models :</p>
  
  <ul>
  <li>Medecine belongsto many Pharmacologic and Pharmacologic belongsto many Medecine</li>
  <li>Medecine belongsto many Therapeutic and Therapeutic belongsto many Medecine</li>
  <li>Medecine belongsto many Galenic and Galenic belongsto many Medecine</li>
  <li>Medecine belongsto many AdministrationMode and AdministrationMode belongsto many Medecine</li>
  <li>Medecine belongsto many ActivePrinciple and ActivePrinciple belongsto many Medecine</li>
  </ul>
  
  <p>Pharmacologic is working well and faster in all case (loadind is normal) -:)</p>
  
  <p>My problem is there, when i execute this type of query in my controller for other relations :</p>
  
  <pre><code>$Pharmacologic = Pharmacologic ::Find(1);
  
  $Medecines= $Pharmacologic -&gt;medecines()-&gt;orderBy('field1', 'asc')
  -&gt;paginate(10);
  
  return view('page', compact('Medecines'));
  </code></pre>
  
  <p>Migrations</p>
  
  <ol>
  <li>Pharmacologic and medecine pivot </li>
  </ol>
  
  <pre class="lang-php prettyprint-override"><code>Schema::create('pharmaco_medecine', function(Blueprint $table) {
  $table-&gt;increments('id');
  $table-&gt;integer('medecine _id')-&gt;unsigned(); $table-&gt;foreign('medecine _id') -&gt;references('id')-&gt;on('tbl_medecine') -&gt;onDelete('cascade');
  $table-&gt;integer('pharmaco_id')-&gt;unsigned(); $table-&gt;foreign('pharmaco_id') -&gt;references('id')-&gt;on('tbl_pharmaco') -&gt;onDelete('cascade'); });
  </code></pre>
  
  <ol start="2">
  <li>Therapeutic and medecine pivot</li>
  </ol>
  
  <pre class="lang-php prettyprint-override"><code>Schema::create('therapeutic_medecine', function(Blueprint $table) {
  
  $table-&gt;increments('id');
  
  $table-&gt;integer('medecine_id')-&gt;unsigned();
  $table-&gt;foreign('medecine_id')
        -&gt;references('id')-&gt;on('tbl_medecine')
        -&gt;onDelete('cascade');
  
  $table-&gt;integer('therapeutic_id')-&gt;unsigned();
  $table-&gt;foreign('therapeutic_id')
        -&gt;references('id')-&gt;on('tbl_therapeutic')
        -&gt;onDelete('cascade');
  
  });
  </code></pre>
  
  <ol start="3">
  <li>Galenic and medecine pivot</li>
  </ol>
  
  <pre class="lang-php prettyprint-override"><code>Schema::create('gal_medecine, function(Blueprint $table) {
  
  $table-&gt;increments('id');
  
  $table-&gt;integer('medecine_id')-&gt;unsigned();
  $table-&gt;foreign('medecine_id')
        -&gt;references('id')-&gt;on('tbl_medecine')
        -&gt;onDelete('cascade');
  
  $table-&gt;integer('gal_id')-&gt;unsigned();
  $table-&gt;foreign('gal_id')
        -&gt;references('id')-&gt;on('tbl_gal')
        -&gt;onDelete('cascade');
  
  });
  </code></pre>
  
  <ol start="4">
  <li>AdministrationMode and medecine pivot</li>
  </ol>
  
  <pre class="lang-php prettyprint-override"><code>Schema::create('medecine_admin_mode', function(Blueprint $table) {
  
  $table-&gt;increments('id');
  
  $table-&gt;integer('medecine_id')-&gt;unsigned();
  $table-&gt;foreign('medecine_id')
        -&gt;references('id')-&gt;on('tbl_medecine')
        -&gt;onDelete('cascade');
  $table-&gt;integer('admin_mode_id')-&gt;unsigned();
  $table-&gt;foreign('admin_mode_id')
        -&gt;references('id')-&gt;on('tbl_adminmode')
        -&gt;onDelete('cascade');
  
  });
  </code></pre>
  
  <ol start="5">
  <li>ActivePrinciple and medecine pivot</li>
  </ol>
  
  <pre class="lang-php prettyprint-override"><code>Schema::create('medecine_active_princip', function(Blueprint $table) {
  
  $table-&gt;increments('id');
  
  $table-&gt;integer('medecine_id')-&gt;unsigned();
  $table-&gt;foreign('medecine_id')
        -&gt;references('id')-&gt;on('tbl_medecine')
        -&gt;onDelete('cascade');
  
  $table-&gt;integer('active_princip_id')-&gt;unsigned();
  $table-&gt;foreign('active_princip_id')
        -&gt;references('id')-&gt;on('tbl_activeprincip')
        -&gt;onDelete('cascade');
  
  });
  </code></pre>
  
  <p>The view is generating data results without any error but is STILL LOADING FOR SEVERAL MINUTES. What im missing ?</p>
  
  <p>Thnx and sorry for this long post</p>
  
  <p>Models</p>
  
  <p>Medecine</p>
  
  <pre><code>class Medecine extends Model
  {
      protected $table='tbl_medecine';
  
  
          public function pharmacologics() 
      {
  
          return $this-&gt;belongsToMany('App\Pharmacologic');
  
      }
  
              public function therapeutics() 
      {
  
          return $this-&gt;belongsToMany('App\Therapeutic');
  
      }
  
                  public function galenics() 
      {
  
          return $this-&gt;belongsToMany('App\Galenic');
  
      }
  
                  public function administrationmodes() 
      {
  
          return $this-&gt;belongsToMany('App\AdministrationMode');
  
      }
  
                  public function activeprinciples() 
      {
  
          return $this-&gt;belongsToMany('App\ActivePrinciple');
  
      }
  }
  </code></pre>
  
  <p>Pharmacologic</p>
  
  <pre><code>class Pharmacologic extends Model
  {
      //
      protected $table='tbl_pharmacologic';
  
      public function medecines() 
      {
  
          return $this-&gt;belongsToMany('App\Medecine');
  
      }
  }
  </code></pre>
  
  <p>And so on ...</p>