We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 956f53c + caa18d9 commit 18ca850Copy full SHA for 18ca850
app/Models/Repository.php
@@ -112,7 +112,7 @@ public static function fromGithub(array $data): ?self
112
}
113
114
try {
115
- return $owner->repositories()->withBlocked()->firstOrCreate([
+ $repository = self::query()->withBlocked()->firstOrNew([
116
'id' => $data['id'],
117
], [
118
'name' => $data['full_name'],
@@ -123,6 +123,10 @@ public static function fromGithub(array $data): ?self
123
'stargazers_count' => $data['stargazers_count'],
124
'website' => $data['homepage'],
125
]);
126
+ $repository->owner()->associate($owner);
127
+ $repository->save();
128
+
129
+ return $repository;
130
} catch (Throwable $ex) {
131
if (
132
$ex instanceof BadMethodCallException
0 commit comments