Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rohan_mhz's avatar

user's comment on specific travel package

can anyone help me with this? I am new to laravel and know the basics only.

I want to create a comment which is associated with the user who posted it to a specific travel package. How will the database tables look like and how do each table relate to each other?

0 likes
3 replies
Sergiu17's avatar
// comments table
$table->increments('id');
$table->unsignedInteger('package_id');
$table->unsignedInteger('user_id');
$table->text('comment');

$table->foreign('package_id')->references('id')->on('packages');
$table->foreign('user_id')->references('id')->on('users');

for other two tables, the structure doesn't matter, it's important for them to have id

1 like
traveltipsguides's avatar

I really liked reading your post! Very high quality content and useful information similar to my travel guide. With such a valuable blog I believe you deserve to be ranking even higher in the search engines.

Please or to participate in this conversation.