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.

32 lines
766 B

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