AliasResource.php 1.0 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class AliasResource extends JsonResource
  5. {
  6. public function toArray($request)
  7. {
  8. return [
  9. 'id' => $this->id,
  10. 'user_id' => $this->user_id,
  11. 'aliasable_id' => $this->aliasable_id,
  12. 'aliasable_type' => $this->aliasable_type,
  13. 'local_part' => $this->local_part,
  14. 'extension' => $this->extension,
  15. 'domain' => $this->domain,
  16. 'email' => $this->email,
  17. 'active' => $this->active,
  18. 'description' => $this->description,
  19. 'emails_forwarded' => $this->emails_forwarded,
  20. 'emails_blocked' => $this->emails_blocked,
  21. 'emails_replied' => $this->emails_replied,
  22. 'recipients' => RecipientResource::collection($this->whenLoaded('recipients')),
  23. 'created_at' => $this->created_at->toDateTimeString(),
  24. 'updated_at' => $this->updated_at->toDateTimeString(),
  25. ];
  26. }
  27. }