I have two tables in MySQL, named manuals
and library
. Both could have uploaded files, so I have made an third table, named files
. In files, I have a column parent_id. Can I make parent_id as foreign key from both manuals and library?
I am using Laravel (4.2) and tried this, but it doesn't work:
$table->integer('parent_id')->unsigned();
$table->foreign('parent_id')->references('id')->on('library');
$table->foreign('parent_id')->references('id')->on('manuals');