Skip to content
Advertisement

Connecting To Firestore Using Laravel 6 Not Working

I’ve been trying to insert data into firestore using my laravel 6 application and it looks like its trying to connect to mysql.

I’ve tried to remove the db part in my .env file:

JavaScript

But it doesnt seem to work. First off this is the error am getting when i try to insert:

JavaScript

This is my php code:

JavaScript

I dont know why its trying to connect using mysql. Anyone know what i need to do or what am doing wrong ???.

Every form of help is highly appreciated. Cheers!!!!

Advertisement

Answer

The env file is only used to override the default database defined in the config/databases.php file, within that file you’ll need to modify this line if you don’t want to use mysql:

JavaScript

However, since it’s trying to connect to a mysql database, somewhere in your project you’re using Laravel’s orm (eloquent) and will need to integrate Firestore at a deeper level into Laravel or refrain from using Eloquent.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement