The problem is that Firestore is not returning any collection data in Laravel. I am using the google/cloud-firestore package for this.
public function __construct(LoggerInterface $logger)
{
$this->firestoreDB = app('firebase.firestore')->database();
$docRef = $this->firestoreDB->collection('user')->document('7UUnkB6sSZgrBYazpmRlpCHJMZm2');
$snapshot = $docRef->snapshot();
if ($snapshot->exists()) {
printf('Document data:' . PHP_EOL);
print_r($snapshot->data());
} else {
printf('Document %s does not exist!' . PHP_EOL, $snapshot->id());
}
die;
$this->logger = $logger;
}
OR
public function __construct(LoggerInterface $logger)
{
$this->firestoreDB = app('firebase.firestore')->database();
$docs = $this->firestoreDB->collection('user')->documents();
dd($docs);
}
I want like print all document in collection and data for specific document.[]