errno: 150 foreign key constraint is incorrectly formed laravel 8
Since increments() creates an unsigned integer column, you need to define the foreign key column as unsigned integer too.
Default migrations in Laravel 6+ use bigIncrements(), so you need to use unsignedBigInteger() method:
$table->unsignedBigInteger('order_id');
https://laravel.com/docs/6.x/migrations#foreign-key-constraints
For default migrations in older versions of Laravel use unsignedInteger() method:
$table->unsignedInteger('order_id');
Or:
$table->integer('order_id')->unsigned();
Also in PHP:
- convert string to uppercase in php
- case upper php
- date('N') php
- detect duplicate in array php
- find strings that contain php
- access config variable in codeigniter controller
- base64 to image
- check array has key data
- clear cache laravel 6
- clear views cache laravel
- create a directory in php if not exists
- How do you clear cache in Laravel?
- create random username with numbers and letters php
- check where key in associative array have a value
- file upload in php through ajax
- clear cache laravel cpanel
- blade format date
- clear the cache in laravel
- clean redis cache
- errors throwing in php
- clearn route cacje laravel
- datetime get month php
- check key array php
- debugger in laravel