ClientProviderBlockResource.php 975 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. class ClientProviderBlockResource extends JsonResource
  6. {
  7. public function toArray(Request $request): array
  8. {
  9. return [
  10. 'id' => $this->id,
  11. 'client_id' => $this->client_id,
  12. 'provider_id' => $this->provider_id,
  13. 'provider_name' => $this->provider_name ?? $this->provider?->user?->name,
  14. 'provider_email' => $this->provider_email ?? $this->provider?->user?->email,
  15. 'provider_phone' => $this->provider_phone ?? $this->provider?->user?->phone,
  16. 'provider_district'=> $this->provider_district ?? null,
  17. 'provider_rating' => $this->provider_rating ?? null,
  18. 'created_at' => $this->created_at?->format('Y-m-d H:i'),
  19. 'updated_at' => $this->updated_at?->format('Y-m-d H:i'),
  20. ];
  21. }
  22. }