You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
741 B

  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class FingerprintResource extends JsonResource
  5. {
  6. public function toArray($request)
  7. {
  8. $resource = [
  9. '_service' => 'user',
  10. '_resource' => 'fingerprints',
  11. ];
  12. foreach ($this->getAttributes() as $attribute => $value) {
  13. switch ($attribute) {
  14. case 'id':
  15. case 'agent':
  16. case 'ip':
  17. case 'os':
  18. case 'latitude':
  19. case 'longitude':
  20. case 'token':
  21. $resource[$attribute] = $value;
  22. break;
  23. }
  24. }
  25. return $resource;
  26. }
  27. }