Im trying to create a foreign keys using artisan, but this error show up.
[Illuminate\\Database\\QueryException]
Looks like this was not the problem for you, but I arrived at this same error in Laravel 5.8 and found an interesting issue: Laravel now defaults the 'id' column to 'bigIncrements' instead of just 'increments'. So instead of referencing it with 'integer' like before, you have to reference it with 'bigInteger'.
If your parent table looks like this:
$table->bigIncrements('id');
Then the child migration needs to look like this:
$table->bigInteger('parent_id')->unsigned()->index();
$table->foreign('parent_id')->references('id')->on('parent');
Hopefully this helps anyone else encountering this problem in 5.8 and beyond.