Category : firebase

I’m encountering a strange behavior with Laravel Jobs and Google Cloud Firestore. This works: Route::get(‘/insert’, function() { $docRef = Firebase::firestore()->database()->collection(‘stats’)->newDocument(); $docRef->set([ ‘from’ => 0, ‘to’ => 100, ‘created_at’ => now() ]); echo "<h1>".’inserted’."</h1>"; }); But when I put the same code in a Laravel queue job, the job works until the $docRef definition then freezes ..

Read more

I try to retrieving data from my firebase using kreait php but it’s always return NULL even though the data is exist in my firebase database. here is my firebase here is my code connection.php <?php require __DIR__.’/vendor/autoload.php’; use KreaitFirebaseFactory; $factory = (new Factory)->withServiceAccount(‘./includes/secret/db-wind-2ceca-672d70f2f4a8.json’)->withDatabaseUri(‘https://db-wind-2ceca-default-rtdb.asia-southeast1.firebasedatabase.app’); $auth = $factory->createAuth(); $database = $factory->createDatabase(); ?> home.php <?php session_start(); if($_SESSION[‘user’] ..

Read more

I have several values in cloud firestore and want to access every variables. Hence I do my code like this <?php require __DIR__.’/vendor/autoload.php’; use GoogleCloudFirestoreFirestoreClient; $db = new FirestoreClient( [ ‘projectId’ => ‘fakedata-aa798’ ] ); $collectionReference = $db->collection(‘Test3’); $docRef = $collectionReference->document(‘User1’); $snapshot = $docRef->snapshot(); $Name= $snapshot[‘Name’]; $Contact= $snapshot[‘Contact no:’]; $Email= $snapshot[‘Email’]; $Location= $snapshot[‘Location’]; $Locationstatus= $snapshot[‘Location ..

Read more

I want to retrieve data from cloud firestore, but I cannot do that and not sure where to start. I tried code referring to get started in firestore but the data is not fetching. This is my code <?php require __DIR__.’/vendor/autoload.php’; use GoogleCloudFirestoreFirestoreClient; $db = new FirestoreClient( [ ‘projectId’ => ‘fakedata-aa798’ ] ); $collectionReference = ..

Read more

I am using Kreait Package for Laravel firebase Authentication and other firebase services I found how to create user and signing with different methods such as email and password, custom token, Idp …etc but I don’t find how to signing with phone number and get verification by SMS here is the documentation I read but ..

Read more

I searched a lot around but I couldn’t find a proper way to simply get current date from Firebase Realtime Database. I would like to use it to set a property called "creation_date". What I have tried to do: use GoogleCloudFirestoreFieldValue; … $newOrderData = [ ‘creation_date’ => firebase.firestore.FieldValue.serverTimestamp(), // or FieldValue::serverTimestamp() ‘order_status’ => ‘TO_BE_PAID’, ‘products’ ..

Read more