PermissionResource.php 855 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
  6. class PermissionResource extends JsonResource
  7. {
  8. /**
  9. * Transform the resource into an array.
  10. *
  11. * @return array<string, mixed>
  12. */
  13. public function toArray(Request $request): array
  14. {
  15. return [
  16. 'id' => $this->id,
  17. 'scope' => $this->scope,
  18. 'description' => $this->description,
  19. 'bits' => $this->bits,
  20. 'parent_id' => $this->parent_id,
  21. 'created_at' => $this->created_at,
  22. 'updated_at' => $this->updated_at,
  23. ];
  24. }
  25. public static function collection($resource): AnonymousResourceCollection
  26. {
  27. return parent::collection($resource);
  28. }
  29. }