PermissionCollection.php 513 B

123456789101112131415161718192021
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\ResourceCollection;
  5. class PermissionCollection extends ResourceCollection
  6. {
  7. /**
  8. * Transform the resource collection into an array.
  9. *
  10. * @return array<int|string, mixed>
  11. */
  12. public function toArray(Request $request): array
  13. {
  14. return $this->collection->transform(function ($permission) {
  15. return new PermissionResource($permission);
  16. })->toArray();
  17. }
  18. }