Support the ongoing development of →
Database Views
Last updated 10 months ago.

Presuming you have the total amount of posts in a posts array you can use the length twig filter

Displaying {{ posts|length }} posts

What do you even mean by a view?
Is it how many times a request is made to a post?

If so how are you tracking views of a post? Do you have a views field on the post that is incremented each time a post is "viewed"? Do you have a post views table that is being inserted into whenever a post is "viewed"? Are you using an external tracking service like Piwik or Google Analytics?

Or is that what you are asking "What is a way to track views of a post?"


Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Agroorama agroorama Joined 2 Feb 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.