UserAppSettingsResource.php 650 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. class UserAppSettingsResource extends JsonResource
  6. {
  7. public static $wrap = null;
  8. /**
  9. * Transform the resource into an array.
  10. *
  11. * @return array<string, mixed>
  12. */
  13. public function toArray(Request $request): array
  14. {
  15. return [
  16. 'id' => (string) $this->profile_id,
  17. 'username' => $request->user()->username,
  18. 'updated_at' => str_replace('+00:00', 'Z', $this->updated_at->format(DATE_RFC3339_EXTENDED)),
  19. 'common' => $this->common,
  20. ];
  21. }
  22. }