RecipientResource.php 814 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class RecipientResource extends JsonResource
  5. {
  6. public function toArray($request)
  7. {
  8. return [
  9. 'id' => $this->id,
  10. 'user_id' => $this->user_id,
  11. 'email' => $this->email,
  12. 'can_reply_send' => $this->can_reply_send,
  13. 'should_encrypt' => $this->should_encrypt,
  14. 'fingerprint' => $this->fingerprint,
  15. 'email_verified_at' => $this->email_verified_at ? $this->email_verified_at->toDateTimeString() : null,
  16. 'aliases' => AliasResource::collection($this->whenLoaded('aliases')),
  17. 'created_at' => $this->created_at->toDateTimeString(),
  18. 'updated_at' => $this->updated_at->toDateTimeString(),
  19. ];
  20. }
  21. }