27 lines
526 B
PHP
27 lines
526 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Kreait\Firebase\Factory;
|
|
|
|
class FirebaseService
|
|
{
|
|
protected $database;
|
|
|
|
public function __construct()
|
|
{
|
|
$factory = (new Factory)
|
|
->withServiceAccount(config('firebase.credentials'))
|
|
->withDatabaseUri(config('firebase.database_url'));
|
|
|
|
$this->database = $factory->createDatabase();
|
|
}
|
|
|
|
public function getTimbanganData()
|
|
{
|
|
return $this->database
|
|
->getReference('timbangan')
|
|
->getValue();
|
|
}
|
|
}
|