Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| UserDeveloperModeResource | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| toArray | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 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 developer_mode update response. |
| 10 | * |
| 11 | * Returns the minimal set of user fields needed to confirm the developer_mode change. |
| 12 | * |
| 13 | * @property string $_id The user's MongoDB document ID |
| 14 | * @property string $email The user's email address |
| 15 | * @property bool $developer_mode Whether developer mode is enabled for the user |
| 16 | */ |
| 17 | class UserDeveloperModeResource extends JsonResource |
| 18 | { |
| 19 | /** |
| 20 | * Transform the resource into an array. |
| 21 | * |
| 22 | * @return array{ |
| 23 | * id: string, |
| 24 | * email: string, |
| 25 | * developer_mode: bool |
| 26 | * } |
| 27 | */ |
| 28 | public function toArray(Request $request): array |
| 29 | { |
| 30 | return [ |
| 31 | 'id' => (string) $this->_id, |
| 32 | 'email' => $this->email, |
| 33 | 'developer_mode' => (bool) $this->developer_mode, |
| 34 | ]; |
| 35 | } |
| 36 | } |