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

Fix content, add command, update readme

This commit is contained in:
Samuel Štancl 2021-08-27 18:37:33 +02:00
parent 3c3a5fcfd9
commit 69d86147d7
12 changed files with 70 additions and 35 deletions

View file

@ -32,7 +32,7 @@ class Thread extends Model
$table->string('slug')->unique();
$table->string('title');
$table->string('tweet_id')->nullable();
$table->foreignId('author_username')->constrained('authors', 'username');
$table->foreignId('author_username')->nullable()->constrained('authors', 'username');
$table->text('content');
$table->json('links')->default('{}');
$table->timestamp('created_at');
@ -58,7 +58,7 @@ class Thread extends Model
if (is_numeric($this->tweet_id)) {
return "https://twitter.com/{$this->author_username}/status/{$this->tweet_id}";
}
return $this->tweet_id;
}