'Lumen migration - Foreign Id with a table name that isn't the plural of the local key

How can I create a Lumen migration with a column that references a table that has an unrelated name to the column name?

Example:

The following would throw an error that user_destinations can't be found.

$table->foreign('user_destination')->references('id')->on('locations');

or

$table->foreignId('warehouse_isle_shelf_id')->constrained();

The intention here is for it to look for warehouse_isles instead of warehouse_isle_shelves or warehouse_isle_shelfs as I'm not sure how Lumen handles plurals for words who's plurals aren't just taking the singular form and appending an s.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source