thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.78k stars 2.67k forks source link

Method Illuminate\Database\Eloquent\Collection::total does not exist #5011

Closed kenzotenma016 closed 4 years ago

kenzotenma016 commented 4 years ago

Version information

Description

File: browse.blade.php [ line: 268 ] Illuminate\Database\Eloquent\Collection $dataTypeContent->total() Exception Method Illuminate\Database\Eloquent\Collection::total does not exist

Steps To Reproduce

Steps to reproduce the behavior:

  1. Enabled server-side pagination on one of the BREADS and ran into this issue.
MrCrayon commented 4 years ago

When you enable server side pagination VoyagerBaseController should pass to the view $dataTypeContent as Illuminate\Pagination\LengthAwarePaginator that has total method.

Can you debug starting from here if $getter is set as paginate? https://github.com/the-control-group/voyager/blob/af4f090adb96d043c887bbc8ddad4dd24fbbd7d0/src/Http/Controllers/VoyagerBaseController.php#L46

kenzotenma016 commented 4 years ago

That's on me. Really sorry about that. I completely forgot that I was overriding the browse.blade.php file for this dataType and had modified $dataTypeContent

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.