I am working on a Laravel project that uses Firebase Firestore to manage some data. Initially, I was using Laravel 9, and everything worked fine. However, after upgrading to Laravel 11, I encountered a problem.
When I try to send data to Firestore from Laravel, I receive the following error in my browser: This site can’t be reached, localhost refused to connect.
Here is the code I’m using:
$section = Section::where('id', $brand->section_id)->first();
$testSection = 0;
$testSection = $brand->section_id == 0
? [
"id" => 0,
"name" => "",
]
: [
"id" => $section->id,
"name" => $section->name,
];
$firestore = app('firebase.firestore')
->database()
->collection('brands')
->document($brand->id)
->set([
"id" => $brand->id,
"name" => $brand->name,
"section" => $testSection,
"image" => $brand->logo,
"contained" => $brand->contained,
"vue" => $brand->vue,
"status" => $brand->status,
]);