Forum

Laravel

Foreign id can be added to the table in several ways

You can add foreign id in your table like these easily.

  • This method creates an UNSIGNED BIGINT equivalent column:
$table->foreignId('product_id');
  • This method adds a {column}_id UNSIGNED BIGINT equivalent column for a given model class (my favorite):
$table->foreignIdFor(Product::class);
  • This method creates a UUID equivalent column:
$table->foreignUuid('product_id');

If you have any, please reply.

akr4m
akr4m
0
4
266
Haz
Haz
Moderator

The whole point of this beta is to test the forum and the functionality. I'm not sure if @alex has plans to keep any of the data during this period, so just be aware of that.

alex
alex
Moderator

All useful discussions will be kept. I’m not wiping everything. Sorry if that wasn’t clear :)

Haz
Haz
Moderator

Good to know. Thanks for clarifying! @alex

tisuchi
tisuchi

@akr4m I think it's all about your design plan.

You can refer to any column as a foreign key.