StoryView.php 496 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace App\Http\Resources;
  3. use App\Services\AccountService;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Http\Resources\Json\JsonResource;
  6. class StoryView extends JsonResource
  7. {
  8. /**
  9. * Transform the resource into an array.
  10. *
  11. * @return array<string, mixed>
  12. */
  13. public function toArray(Request $request)
  14. {
  15. $res = AccountService::get($this->profile_id, true);
  16. $res['viewed_at'] = $this->created_at->format('c');
  17. return $res;
  18. }
  19. }