I don\'t know why it\'s still don\'t work and show this:
Illuminate\\Database\\QueryException : SQLSTATE[HY000]: General error: 1005 Can\'t create tabl
You foreign key needs to have the same type as the key it references. Therefor the second table foreign key doba
needs to be change to this, becuase you use BigIncrements()
in the first table primary key.
$table->unsignedBigInteger('doba');
The problem here is that id_druhu
in druh_knihies
is defined as bigIncrements
and you create doba
as unsignedInteger
and when using foreign key type should be exactly same. So in this case instead of
$table->unsignedInteger('doba');
you should use
$table->unsignedBigInteger('doba');