ActionByApprovalLogResource.php 657 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Http\Resources\API;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. class ActionByApprovalLogResource extends JsonResource
  6. {
  7. /**
  8. * Transform the resource into an array.
  9. *
  10. * @return array<string, mixed>
  11. */
  12. public function toArray(Request $request): array
  13. {
  14. return [
  15. 'action' => $this->action,
  16. 'action_label' => __('action-labels.label.' . $this->action),
  17. 'comment' => $this->comment,
  18. 'created_at' => (string)$this->created_at,
  19. 'created_by' => new UserProfileResource($this->createdBy),
  20. ];
  21. }
  22. }