mstdmstd
mstdmstd

Reputation: 3115

How to get number of all rows in livewire render paginated method?

In my laravel 7 app using livewire/livewire 1.3 I use pagination in component :

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)
        ]);
    }

I also need to get number of all rows in related table, how can I do it with method above ?

Upvotes: 0

Views: 2718

Answers (1)

Docs

{{ $facilityDataRows->total() }}

Upvotes: 1

Related Questions