mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 13:24:03 +00:00
Use Author::updateOrCreate instead of firstOrCreate
This commit is contained in:
parent
f1e283e142
commit
72fff055f4
1 changed files with 1 additions and 1 deletions
|
|
@ -75,7 +75,7 @@ class Tip extends Model
|
||||||
'content' => (string) Str::of($tweet->text)->explode("\n")->skip(1)->join("\n"),
|
'content' => (string) Str::of($tweet->text)->explode("\n")->skip(1)->join("\n"),
|
||||||
'tweet_id' => $tweet->id,
|
'tweet_id' => $tweet->id,
|
||||||
'thread_slug' => $threadSlug ?? optional(Thread::firstWhere('tweet_id', $tweet->threadId))->slug,
|
'thread_slug' => $threadSlug ?? optional(Thread::firstWhere('tweet_id', $tweet->threadId))->slug,
|
||||||
'author_username' => Author::firstOrCreate([
|
'author_username' => Author::updateOrCreate(['username' => $tweet->author->username], [
|
||||||
'username' => $tweet->author->username,
|
'username' => $tweet->author->username,
|
||||||
'name' => $tweet->author->name,
|
'name' => $tweet->author->name,
|
||||||
'avatar' => $tweet->author->profile_image_url,
|
'avatar' => $tweet->author->profile_image_url,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue