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.

38 lines
883 B

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