Неустранимая ошибка: вызов неопределенного метода Google\Cloud\Firestore\QuerySnapshot::count()Php

Кемеровские программисты php общаются здесь
Anonymous
Неустранимая ошибка: вызов неопределенного метода Google\Cloud\Firestore\QuerySnapshot::count()

Сообщение Anonymous »

Я хочу вывести 5000 пользовательских документов из Firerstore в таблицу HTML с помощью Laravel, но получаю ошибку «вызов неопределенного метода Google\Cloud\Firestore\QuerySnapshot::count()». Пожалуйста, в чем я ошибаюсь:
public function history(Request $request)
{
$history = app('firebase.firestore')->database()->collection($this->tablenamePayment);
$lastVisible = null;
if ($request->input('last_visible')) {
$lastVisible = $history->document($request->input('last_visible'))->snapshot();
}
$query = $history->startAt($lastVisible ? [$lastVisible] : []);
$documents = $query->limit(2000)->documents();
$data = [];
foreach ($documents as $document) {
$data[] = [
'id' => $document->id(),
'name' => $document->get('name'),
'email' => $document->get('email'),
];
}
$nextVisible = null;
if ($documents->count() === 2000) {
$nextVisible = $documents->last()->id();
}
return view('admin.payment-history', compact('data', 'nextVisible'));
}

// View (Blade template):




ID
Name
Email



@foreach($data as $document)

{{ $document['id'] }}
{{ $document['name'] }}
{{ $document['email'] }}

@endforeach



@if ($nextVisible)
$nextVisible]) }}">Next Page
@endif


Подробнее здесь: https://stackoverflow.com/questions/787 ... apshotcoun

Вернуться в «Php»