Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
50.00% |
1 / 2 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| UserBetaFlagService | |
50.00% |
1 / 2 |
|
50.00% |
1 / 2 |
2.50 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| updateBetaFlag | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Services\Admin\Users; |
| 4 | |
| 5 | use App\Http\Models\Auth\User; |
| 6 | use App\Http\Repositories\UserRepository; |
| 7 | |
| 8 | /** |
| 9 | * Service for managing user beta flag operations. |
| 10 | * |
| 11 | * Orchestrates the business logic for toggling a user's beta access flag, |
| 12 | * delegating data access to the UserRepository. |
| 13 | */ |
| 14 | class UserBetaFlagService |
| 15 | { |
| 16 | public function __construct( |
| 17 | private UserRepository $userRepository |
| 18 | ) {} |
| 19 | |
| 20 | /** |
| 21 | * Update the is_beta flag for a given user. |
| 22 | * |
| 23 | * @param User $user The target user |
| 24 | * @param bool $isBeta Whether to enable or disable beta access |
| 25 | * @return User The updated user |
| 26 | */ |
| 27 | public function updateBetaFlag(User $user, bool $isBeta): User |
| 28 | { |
| 29 | return $this->userRepository->updateBetaFlag($user, $isBeta); |
| 30 | } |
| 31 | } |