cyrildewit / eloquent-viewable

Associate views with Eloquent models in Laravel
MIT License
803 stars 104 forks source link

how to get total number of views of all posts #262

Closed PaulChase closed 1 year ago

PaulChase commented 2 years ago

Question:

How do I access the total number of posts and other metrics for all the posts in my posts table?

I want to be able to access the metrics of all the posts not that I have to find a post by the ID then pass it as a parameter to the views method. Is they a way I can get that done?

cyrildewit commented 2 years ago

Hey @PaulChase,

This package is basically providing an Eloquent model (View) and predefined relationships/order by queries. Anything else that's not supported out the blue, can be implemented by using the provided functionality from Eloquent.

If you think your solution might be useful for others, feel free to send create a pull request to add it to the core.