| 123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Http\Resources;
- use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\JsonResource;
- class AuthResource extends JsonResource
- {
- /**
- * Transform the resource into an array.
- *
- * @return array<string, mixed>
- */
- public function toArray(Request $request): array
- {
- return [
- 'access_token' => $this['access_token'],
- 'token_type' => 'Bearer',
- 'expires_in' => 900,
- 'user' => new UserResource($this['user']),
- ];
- }
- public static function collection($resource): AnonymousResourceCollection
- {
- return parent::collection($resource);
- }
- }
|