Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| UserBetaFlagResource | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| toArray | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Resources\v2\Admin; |
| 4 | |
| 5 | use Illuminate\Http\Request; |
| 6 | use Illuminate\Http\Resources\Json\JsonResource; |
| 7 | |
| 8 | /** |
| 9 | * Resource for the user beta flag update response. |
| 10 | * |
| 11 | * Returns the minimal set of user fields needed to confirm the beta flag change. |
| 12 | * |
| 13 | * @property string $_id The user's MongoDB document ID |
| 14 | * @property string $email The user's email address |
| 15 | * @property bool $is_beta Whether the user has access to beta features |
| 16 | */ |
| 17 | class UserBetaFlagResource extends JsonResource |
| 18 | { |
| 19 | /** |
| 20 | * Transform the resource into an array. |
| 21 | * |
| 22 | * @return array{ |
| 23 | * id: string, |
| 24 | * email: string, |
| 25 | * is_beta: bool |
| 26 | * } |
| 27 | */ |
| 28 | public function toArray(Request $request): array |
| 29 | { |
| 30 | return [ |
| 31 | 'id' => (string) $this->_id, |
| 32 | 'email' => $this->email, |
| 33 | 'is_beta' => (bool) $this->is_beta, |
| 34 | ]; |
| 35 | } |
| 36 | } |