From e28d49dc716779dcd95bda001def1b8f6ec85442 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Fri, 6 Nov 2020 00:27:07 +0700 Subject: [PATCH] Textadventures: one author per game pls --- app/Sources/Textadventures.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Sources/Textadventures.php b/app/Sources/Textadventures.php index 49d562a..6d876d4 100644 --- a/app/Sources/Textadventures.php +++ b/app/Sources/Textadventures.php @@ -87,8 +87,8 @@ class Textadventures extends Source { } $game->save(); $game->languages()->sync([$language->id]); - if (isset($author)) { - $game->authors()->sync([$model->id]); + if (isset($author) && !$game->authors()->where('id', $model->id)->exists()) { + $game->authors()->attach($model); } }); }