Skip to content

Commit f05cbff

Browse files
committed
Rename database fields
1 parent 41ae55a commit f05cbff

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

app/Helpers/HasLikes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function dislikedBy(User $user)
2626

2727
public function likes()
2828
{
29-
return $this->morphMany(Like::class, 'liked');
29+
return $this->morphMany(Like::class, 'likeable');
3030
}
3131

3232
public function isLikedBy(User $user)

database/migrations/2017_12_03_111900_create_likes_table.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ public function up()
1616
Schema::create('likes', function (Blueprint $table) {
1717
$table->increments('id');
1818
$table->unsignedInteger('user_id');
19-
$table->unsignedInteger('liked_id');
20-
$table->string('liked_type');
19+
$table->unsignedInteger('likeable_id');
20+
$table->string('likeable_type');
2121
$table->timestamps();
22-
23-
$table->unique(['user_id', 'liked_id', 'liked_type']);
2422
});
2523
}
2624

0 commit comments

Comments
 (0)