title: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails - Laravel
body: <p>I'm getting this error, upon running  <code>php artisan migrate</code>.</p>
  <pre class="lang-dart prettyprint-override"><code>  SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (SQL: drop table if exists `products`)
  </code></pre>
  <p><code>create_products_table.php</code> inside migration</p>
  <pre class="lang-dart prettyprint-override"><code>public function up()
      {
          Schema::dropIfExists('products');
          Schema::create('products', function (Blueprint $table) {
              $table-&gt;id();
              $table-&gt;string('name');
              //  Other attributes here
              
              $table-&gt;bigInteger('ctg_id')-&gt;unsigned();
              $table-&gt;bigInteger('product_variation_id')-&gt;unsigned();  
              $table-&gt;bigInteger('sub_ctg_id')-&gt;unsigned();
              $table-&gt;bigInteger('vehicle_id')-&gt;unsigned();  
  
              $table-&gt;foreign('ctg_id')-&gt;references('id')-&gt;on('ctgs')-&gt;constrained()-&gt;onDelete('cascade')-&gt;onUpdate('cascade');
              $table-&gt;foreign('product_variation_id')-&gt;references('id')-&gt;on('product_variations')-&gt;constrained()-&gt;onDelete('cascade')-&gt;onUpdate('cascade');
              $table-&gt;foreign('sub_ctg_id')-&gt;references('id')-&gt;on('sub_ctgs')-&gt;constrained()-&gt;onDelete('cascade')-&gt;onUpdate('cascade');
              $table-&gt;foreign('vehicle_id')-&gt;references('id')-&gt;on('vehicles')-&gt;constrained()-&gt;onDelete('cascade')-&gt;onUpdate('cascade');
              $table-&gt;timestamps();
          });
      }
      public function down()
      {
          Schema::dropIfExists('products');
      }
  </code></pre>
  <p>I searched online, got this solution, changed the code accordingly but in vain
  <a href="https://stackoverflow.com/a/47544195/7290043">https://stackoverflow.com/a/47544195/7290043</a></p>
  <p><a href="https://i.stack.imgur.com/anm86.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/anm86.png" alt="enter image description here" /></a></p>
  <p>For now, I'm just working with the below tables</p>