Skip to content

Commit

Permalink
change users type to collection
Browse files Browse the repository at this point in the history
  • Loading branch information
santutu committed Oct 19, 2019
1 parent fad0f81 commit 300d2c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Laravel Echo Client

__version 0.1__
__version 0.1.1__

### Installation

Expand Down
5 changes: 3 additions & 2 deletions src/EchoClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Santutu\LaravelEchoClient;


use Illuminate\Support\Collection;
use Santutu\LaravelEchoClient\Models\Channels;

class EchoClient
Expand Down Expand Up @@ -75,15 +76,15 @@ 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;
}

$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);
}


Expand Down
3 changes: 2 additions & 1 deletion src/Facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 300d2c9

Please sign in to comment.