How to get data from firebase using php? i want to fetch data from reference in a document

one text

l want to fetch user_reference data and post_reference data how can i do that?

function flagged(){

$documents = $this->db->collection('Flagged Tasks')
    ->documents();
$flagged = [];
for each ($documents as $document) {
    if ($document->exists()) {
        $flagged[$document->id()] = $document->data();
        

         
        // $flagged[$document->id()] = $document->id();
    }
}

return $flagged;

}

enter image description here

Source