Laravel Foreign key constraint is incorrectly formed,some problem with my category_id foreign key
Asked
Active
Viewed 63 times
-2
-
Possible duplicate of [Laravel Migration Foreign key constraint is incorrectly formed](https://stackoverflow.com/questions/32669880/laravel-migration-foreign-key-constraint-is-incorrectly-formed) – tempra Oct 19 '19 at 06:40
-
can you show us your table and model.? – prasanna purohit Oct 19 '19 at 08:31
1 Answers
0
$table->unsignedBigInteger('anynameyouwant_id');
$table->foreign('anynameyouwant_id')->references('id')->on('which table you want to refer');
this is the basic concept of the foreign key in laravel. .

prasanna purohit
- 98
- 8