Laravel 11 foreign key not showing up in SQL

50 Views Asked by At

What steps should I follow to correctly set up two foreign keys in Laravel 11, as I've been having difficulties with this task?

$table->id();

$table->foreignId('news_id')
      ->constrained(table: 'news')
      ->cascadeOnDelete()
      ->cascadeOnUpdate();

$table->foreignId('category_id')
      ->constrained(table: 'categories')
      ->cascadeOnDelete()
      ->cascadeOnUpdate();

$table->timestamps();

Image of my db designer

0

There are 0 best solutions below