Skip to content
Advertisement

Using Barcode Number as Primary Key in Laravel

I have problem to define the barcode number as the primary key at Item table. Previously I use the usual ID as the primary key.

JavaScript

Now, when I want to change the type of id to integer barcode number, it does not work.

JavaScript

I got the error below after running php artisan migrate

JavaScript

The Order table below has foreign key reference to Item table.

JavaScript

Advertisement

Answer

Try this one. hopefully it will work

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement