diff --git a/app/role.php b/app/Comment.php similarity index 72% rename from app/role.php rename to app/Comment.php index 20efdbb..739e47e 100644 --- a/app/role.php +++ b/app/Comment.php @@ -4,7 +4,7 @@ use Illuminate\Database\Eloquent\Model; -class role extends Model +class Comment extends Model { // } diff --git a/database/migrations/2019_05_27_012120_create_likes_table.php b/database/migrations/2019_05_27_012120_create_likes_table.php new file mode 100644 index 0000000..291f80a --- /dev/null +++ b/database/migrations/2019_05_27_012120_create_likes_table.php @@ -0,0 +1,30 @@ +unsignedInteger('podcast_id')->index(); + $table->unsignedInteger('user_id')->index(); + $table->timestamps(); + + $table->primary(['podcast_id', 'user_id']); + }); + } + + /** + * Reverse the migrations. + */ + public function down() + { + Schema::dropIfExists('likes'); + } +} diff --git a/database/migrations/2019_05_27_012151_create_comments_table.php b/database/migrations/2019_05_27_012151_create_comments_table.php new file mode 100644 index 0000000..22c50b7 --- /dev/null +++ b/database/migrations/2019_05_27_012151_create_comments_table.php @@ -0,0 +1,31 @@ +bigIncrements('id'); + $table->unsignedInteger('podcast_id')->index(); + $table->unsignedInteger('user_id')->index(); + $table->text('body'); + $table->unsignedInteger('parent_id')->default(0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down() + { + Schema::dropIfExists('comments'); + } +}