refactor: reorganize FeedbackService methods; move delete method and restore pendingCount method for improved clarity

This commit is contained in:
Yoga Pangestu 2026-09-03 16:27:33 +07:00
parent 32c04b91dd
commit f6da193473

View File

@ -41,17 +41,6 @@ public function __construct()
$this->sanitizer = new HtmlSanitizer($config);
}
public function pendingCount(User $user): int
{
if (! $user->can('update-feedback-status')) {
return 0;
}
return Feedback::query()
->where('status', FeedbackStatus::Submitted)
->count();
}
public function paginated(User $user, int $perPage = 25, string $search = '', ?string $type = null, ?string $status = null): LengthAwarePaginator
{
return Feedback::query()
@ -85,6 +74,11 @@ public function update(Feedback $feedback, array $data): Feedback
return $feedback;
}
public function delete(Feedback $feedback): bool
{
return $feedback->delete();
}
public function updateStatus(Feedback $feedback, string $status): Feedback
{
$feedback->update([
@ -107,8 +101,14 @@ public function reply(Feedback $feedback, string $reply): Feedback
return $feedback;
}
public function delete(Feedback $feedback): bool
public function pendingCount(User $user): int
{
return $feedback->delete();
if (! $user->can('update-feedback-status')) {
return 0;
}
return Feedback::query()
->where('status', FeedbackStatus::Submitted)
->count();
}
}