1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00

Support moments in thread tweet_id

This commit is contained in:
Samuel Štancl 2021-08-16 18:52:49 +02:00 committed by GitHub
parent 798cf7f1b9
commit 8e123a49f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,9 +55,13 @@ class Thread extends Model
public function getTweetUrlAttribute(): string public function getTweetUrlAttribute(): string
{ {
if (is_numeric($this->tweet_id)) {
return "https://twitter.com/{$this->author_username}/status/{$this->tweet_id}"; return "https://twitter.com/{$this->author_username}/status/{$this->tweet_id}";
} }
return $this->tweet_id;
}
public function getKeyName() public function getKeyName()
{ {
return 'slug'; return 'slug';