mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 21:34:03 +00:00
Weekly Thread command
This commit is contained in:
parent
faefe1c45b
commit
3fe86bed08
3 changed files with 80 additions and 5 deletions
|
|
@ -40,12 +40,15 @@ class Thread extends Model
|
|||
|
||||
public static function booted()
|
||||
{
|
||||
static::creating(fn (self $model) => $model->created_at ??= now());
|
||||
static::creating(static function (self $model) {
|
||||
$model->created_at ??= now();
|
||||
$model->links ??= [];
|
||||
});
|
||||
}
|
||||
|
||||
public function tips(): HasMany
|
||||
{
|
||||
return $this->hasMany(Tip::class);
|
||||
return $this->hasMany(Tip::class, 'thread_slug');
|
||||
}
|
||||
|
||||
public function author(): BelongsTo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue