ClientFavoriteProviderResource.php 1.1 KB

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. class ClientFavoriteProviderResource 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. 'city_name' => $this->city_name ?? null,
  15. 'average_rating' => $this->average_rating ?? null,
  16. 'daily_price_8h' => $this->daily_price_8h ?? null,
  17. 'daily_price_6h' => $this->daily_price_6h ?? null,
  18. 'daily_price_4h' => $this->daily_price_4h ?? null,
  19. 'daily_price_2h' => $this->daily_price_2h ?? null,
  20. 'total_services' => $this->total_services ?? null,
  21. 'notes' => $this->notes,
  22. 'created_at' => $this->created_at?->format('Y-m-d H:i'),
  23. 'updated_at' => $this->updated_at?->format('Y-m-d H:i'),
  24. ];
  25. }
  26. }