ProviderClientBlockResource.php 798 B

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