Laravel AT Protocol Client (alpha & unstable)
at dev 36 lines 863 B view raw
1<?php 2 3namespace SocialDept\AtpClient\Data\Responses\Chat\Convo; 4 5use Illuminate\Contracts\Support\Arrayable; 6use Illuminate\Support\Collection; 7 8/** 9 * @implements Arrayable<string, mixed> 10 */ 11class GetLogResponse implements Arrayable 12{ 13 /** 14 * @param Collection<int, mixed> $logs Collection of log event objects (LogBeginConvo, LogCreateMessage, etc.) 15 */ 16 public function __construct( 17 public readonly Collection $logs, 18 public readonly ?string $cursor = null, 19 ) {} 20 21 public static function fromArray(array $data): self 22 { 23 return new self( 24 logs: collect($data['logs'] ?? []), 25 cursor: $data['cursor'] ?? null, 26 ); 27 } 28 29 public function toArray(): array 30 { 31 return [ 32 'logs' => $this->logs->all(), 33 'cursor' => $this->cursor, 34 ]; 35 } 36}