whereUserId(Auth::id());
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function admin(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function reply(): HasMany
{
return $this->hasMany(TicketReply::class);
}
public function close(): bool
{
$this->status = 2;
return $this->save();
}
public function getStatusLabelAttribute(): string
{
return match ($this->attributes['status']) {
0 => ''.trans('common.status.pending').'',
1 => ''.trans('common.status.reply').'',
2 => ''.trans('common.status.closed').'',
default => ''.trans('common.status.unknown').'',
};
}
}