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
825 B

  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class BusinessResource extends JsonResource
  5. {
  6. public function toArray($request)
  7. {
  8. $resource = [
  9. '_service' => 'user',
  10. '_resource' => 'businesses',
  11. ];
  12. foreach ($this->getAttributes() as $attribute => $value) {
  13. switch ($attribute) {
  14. case 'name':
  15. case 'slug':
  16. case 'wallet':
  17. case 'files_volume':
  18. case 'cache':
  19. case 'calculated_at':
  20. case 'created_at':
  21. case 'updated_at':
  22. case 'deleted_at':
  23. $resource[$attribute] = $value;
  24. break;
  25. }
  26. }
  27. return $resource;
  28. }
  29. }