Getting error while connecting laravel with firebase

Viewed 164

I am working on Laravel 8 and want to connect Firebase with Laravel application. I have done all necessary required installation, setup and changes in files (.env, web.php, app.php, etc...) for firebase connection in my application by following the youtube tutorial (link given):

https://www.youtube.com/watch?v=kCq3tQJi88s&list=PLRheCL1cXHrsiMM3NmWMeEBrO6_XHSt5j&index=2

Now I am trying to insert data in the firebase database and I get this error:

SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it (SQL: select count(*) as aggregate from users where email = xyz@gmail.com)

my question is while I have done all changes according to firebase database connection but still it is trying to connect with MySQL database, why? Where I am doing wrong?

Following I provide code where I did changes according to firebase database.

.env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myDb
DB_USERNAME=root
DB_PASSWORD=

//Here I add these two line
FIREBASE_CREDENTIALS="mydb-firebase-adminsdk-z4ckd-a26e5ce8be.json"
FIREBASE_DATABASE_URL="https://mydb-default-rtdb.firebaseio.com/"

app.php file:

         /*
         * Package Service Providers...
         */
//I add this line in this file:
Kreait\Laravel\Firebase\ServiceProvider::class,
1 Answers

You need to specify the service and the controller in order to get connected to the firebase database

Related