mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 05:14:04 +00:00
* Use Author::updateOrCreate instead of firstOrCreate * Weekly tips #4
This commit is contained in:
parent
f1e283e142
commit
e907eba3dd
16 changed files with 140 additions and 4 deletions
|
|
@ -75,7 +75,7 @@ class Tip extends Model
|
|||
'content' => (string) Str::of($tweet->text)->explode("\n")->skip(1)->join("\n"),
|
||||
'tweet_id' => $tweet->id,
|
||||
'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,
|
||||
'name' => $tweet->author->name,
|
||||
'avatar' => $tweet->author->profile_image_url,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue