Skip to content

Commit

Permalink
fix: access enum cases using the value attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadmp97 committed Sep 5, 2023
1 parent 4b5cd56 commit bc35cbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/Actions/Challenge/CreateChallengeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public function execute(User $user, array $data): Challenge
{
$ongoingChallenge = Challenge::query()
->where('user_id', $user->id)
->where('status', ChallengeStatus::ONGOING);
->where('status', ChallengeStatus::ONGOING->value);

if ($ongoingChallenge->exists()) {
abort(400, 'You have an uncompleted challenge!');
}

$data = array_merge($data, [
'user_id' => $user->id,
'status' => ChallengeStatus::ONGOING,
'status' => ChallengeStatus::ONGOING->value,
'continued_at' => now(),
]);

Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Challenge/StopChallengeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function execute(Challenge $challenge): void
}

$challenge->update([
'status' => ChallengeStatus::STOPPED,
'status' => ChallengeStatus::STOPPED->value,
]);
}
}

0 comments on commit bc35cbf

Please sign in to comment.