BannerCollection.php 620 B

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