Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 67a0560

Browse files
authored
Merge pull request #1 from MartijnDB/Match-new-version-of-kreait/firebase-php-1
Match new version of kreait/firebase-php
2 parents aadecf6 + 688ad6e commit 67a0560

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Broadcasters/RTDB.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ class RTDB extends Broadcaster
2323
*/
2424
public function __construct($config)
2525
{
26-
$sr_account = ServiceAccount::fromJsonFile(base_path($config['creds_file']));
2726
$this->config = $config;
28-
$this->db = (new Factory())
29-
->withServiceAccount($sr_account)
30-
->withDatabaseUri($config['databaseURL'])
31-
->create();
27+
$factory = (new \Kreait\Firebase\Factory())
28+
->withServiceAccount(base_path($config['creds_file']))
29+
->withDatabaseUri($config['databaseURL']);
30+
31+
32+
$this->db = $factory->createDatabase();
3233
}
3334

3435
/**
3536
* {@inheritdoc}
3637
*/
3738
public function broadcast(array $channels, $event, array $payload = [])
3839
{
39-
$db = $this->db->getDatabase();
4040
$socket = Arr::pull($payload, 'socket');
4141

4242
foreach ($this->formatChannels($channels) as $channel) {
4343
try {
44-
$db->getReference($this->config['collection_name'])
44+
$this->db->getReference($this->config['collection_name'])
4545
->push([
4646
'channel' => $channel,
4747
'data' => $payload,

0 commit comments

Comments
 (0)