ProviderSpecialityResource.php 684 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. class ProviderSpecialityResource extends JsonResource
  6. {
  7. /**
  8. * Transform the resource into an array.
  9. *
  10. * @return array<string, mixed>
  11. */
  12. public function toArray(Request $request): array
  13. {
  14. return [
  15. 'id' => $this->id,
  16. 'provider_id' => $this->provider_id,
  17. 'speciality_id' => $this->speciality_id,
  18. 'speciality' => new SpecialityResource($this->whenLoaded('speciality')),
  19. 'created_at' => $this->created_at,
  20. 'updated_at' => $this->updated_at,
  21. ];
  22. }
  23. }