Skip to content
This repository was archived by the owner on Aug 20, 2023. It is now read-only.

Commit 6f210e2

Browse files
Updated migration file
1 parent 0dc3625 commit 6f210e2

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

README_TR.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ $post->hasFavorite(); // $post'un, mevcut kullanıcı için (auth()->user()) fav
3030
$post->addFavorite(); // $post'u, mevcut kullanıcı için (auth()->user()) 'favori' olarak kaydeder
3131
$post->unFavorite(); // $post'un, mevcut kullanıcıya ait (auth()->user()) 'favori' kaydını siler
3232
$post->deleteFavorites(); // $post'a ait tüm favori kayıtlarını siler
33+
$post->favorites()->count(); // $post'u favori olarak kaydeden toplam kullanıcı/kayıt sayısı
3334
```
3435
---
3536
* (Tercihen) UserFavorites trait dosyasını ```User``` model'a ekleyin;

migrations/2020_05_06_014641_create_favorites_table.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ public function up()
1919
$table->unsignedInteger('user_id');
2020
$table->timestamps();
2121

22-
$table->foreign('user_id')
23-
->references('id')
24-
->on('users')
25-
->onDelete('cascade');
26-
2722
$table->unique(['favoriteable_id', 'favoriteable_type', 'user_id']);
2823
});
2924
}

0 commit comments

Comments
 (0)