diff --git a/readme.md b/readme.md index bbf1588..093950b 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ ## Laravel Echo Client -__version 0.1__ +__version 0.1.1__ ### Installation diff --git a/src/EchoClient.php b/src/EchoClient.php index 0b7962d..834219a 100644 --- a/src/EchoClient.php +++ b/src/EchoClient.php @@ -3,6 +3,7 @@ namespace Santutu\LaravelEchoClient; +use Illuminate\Support\Collection; use Santutu\LaravelEchoClient\Models\Channels; class EchoClient @@ -75,7 +76,7 @@ public function getChannel(string $channelName): object } - public function getUsers(string $channelName): array + public function getUsers(string $channelName): Collection { if (mb_strpos($channelName, $this->presencePrefix) !== 0) { $channelName = $this->presencePrefix . $channelName; @@ -83,7 +84,7 @@ public function getUsers(string $channelName): array $res = $this->client->get("apps/{$this->appId}/channels/{$channelName}/users?auth_key={$this->authKey}"); - return json_decode($res->getBody()->getContents())->users; + return collect(json_decode($res->getBody()->getContents())->users); } diff --git a/src/Facade.php b/src/Facade.php index be43607..da26de0 100644 --- a/src/Facade.php +++ b/src/Facade.php @@ -4,6 +4,7 @@ namespace Santutu\LaravelEchoClient; +use Illuminate\Support\Collection; use Santutu\LaravelEchoClient\Models\AppStatus; use Santutu\LaravelEchoClient\Models\Channel; use Santutu\LaravelEchoClient\Models\Channels; @@ -12,7 +13,7 @@ * @method static AppStatus getAppStatus() * @method static Channels getChannels() * @method static Channel getChannel(string $channelName) - * @method static array getUsers(string $channelName) + * @method static Collection getUsers(string $channelName) * * * * @see \Santutu\LaravelEchoClient\EchoClient;