如何在livewire渲染分页方法中获取所有行数?

时间:2020-07-23 07:40:29

标签: laravel laravel-livewire

在使用livewire / livewire 1.3的laravel 7应用程序中,我使用分页 在组件中:

class Facilities extends Component
{
    use WithPagination;

    public function render()
    {
        ...
        return view('livewire.admin.facilities.container', [
            'facilityDataRows' => Facility
                ::orderBy('created_at', 'desc')
                ->paginate($backend_pagination_by_rows)
        ]);
    }

我还需要获取相关表中所有行的数量,如何使用上述方法呢?

1 个答案:

答案 0 :(得分:-1)

Docs

{{ $facilityDataRows->total() }}