CurrencyCollection.php 690 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Resources\V2;
  3. use Illuminate\Http\Resources\Json\ResourceCollection;
  4. class CurrencyCollection extends ResourceCollection
  5. {
  6. public function toArray($request)
  7. {
  8. return [
  9. 'data' => $this->collection->map(function($data) {
  10. return [
  11. 'name' => $data->name,
  12. 'code' => $data->code,
  13. 'symbol' => $data->symbol,
  14. 'exchange_rate' => (double) $data->exchange_rate
  15. ];
  16. })
  17. ];
  18. }
  19. public function with($request)
  20. {
  21. return [
  22. 'success' => true,
  23. 'status' => 200
  24. ];
  25. }
  26. }