Pārlūkot izejas kodu

ajuste validacao carteirinha para exibir foto e data da validade

Gustavo Zanatta 1 mēnesi atpakaļ
vecāks
revīzija
4199a5578a
1 mainītis faili ar 8 papildinājumiem un 9 dzēšanām
  1. 8 9
      app/Http/Resources/AssociateValidationResource.php

+ 8 - 9
app/Http/Resources/AssociateValidationResource.php

@@ -4,6 +4,7 @@ namespace App\Http\Resources;
 
 use Illuminate\Http\Request;
 use Illuminate\Http\Resources\Json\JsonResource;
+use Illuminate\Support\Facades\Storage;
 
 class AssociateValidationResource extends JsonResource
 {
@@ -11,16 +12,14 @@ class AssociateValidationResource extends JsonResource
     {
         return [
 
-            'id' => $this->id,
-
-            'name' => $this->name,
-
-            'cpf' => $this->cpf,
-
+            'id'           => $this->id,
+            'name'         => $this->name,
+            'cpf'          => $this->cpf,
             'registration' => $this->registration,
-
-            'avatar' => $this->avatar,
-
+            'photo_url'    => $this->photo_path
+                                ? Storage::disk('s3')->temporaryUrl($this->photo_path, now()->addHours(24))
+                                : null,
+            'expiry_date'  => $this->expiry_date?->format('d/m/Y'),
         ];
     }
 }