new helpdesk module
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user