new helpdesk module

This commit is contained in:
Mark Gregory
2026-06-12 10:56:36 +01:00
parent 67faed6165
commit 98c6ee4597
49 changed files with 2554 additions and 255 deletions
+13 -1
View File
@@ -17,7 +17,7 @@ final class Comment extends Model
protected $table = 'helpdesk_comments';
/** @var list<string> */
protected $fillable = ['ticket_id', 'user_id', 'body', 'is_internal'];
protected $fillable = ['ticket_id', 'parent_id', 'user_id', 'body', 'is_internal'];
/** @var array<string, string> */
protected $casts = ['is_internal' => 'boolean'];
@@ -28,6 +28,18 @@ final class Comment extends Model
return $this->belongsTo(Ticket::class, 'ticket_id');
}
/** @return BelongsTo<Comment, Comment> */
public function parent(): BelongsTo
{
return $this->belongsTo(self::class, 'parent_id');
}
/** @return HasMany<Comment> */
public function replies(): HasMany
{
return $this->hasMany(self::class, 'parent_id')->oldest();
}
/** @return BelongsTo<User, Comment> */
public function user(): BelongsTo
{