Skip to content

Commit 18ca850

Browse files
authored
Merge pull request #180 from Astrotomic/dev
fix moved repositories
2 parents 956f53c + caa18d9 commit 18ca850

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/Models/Repository.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static function fromGithub(array $data): ?self
112112
}
113113

114114
try {
115-
return $owner->repositories()->withBlocked()->firstOrCreate([
115+
$repository = self::query()->withBlocked()->firstOrNew([
116116
'id' => $data['id'],
117117
], [
118118
'name' => $data['full_name'],
@@ -123,6 +123,10 @@ public static function fromGithub(array $data): ?self
123123
'stargazers_count' => $data['stargazers_count'],
124124
'website' => $data['homepage'],
125125
]);
126+
$repository->owner()->associate($owner);
127+
$repository->save();
128+
129+
return $repository;
126130
} catch (Throwable $ex) {
127131
if (
128132
$ex instanceof BadMethodCallException

0 commit comments

Comments
 (0)