Insights
laravel-trend groups the posts by period with one query and fills the periods without posts with zero. The charts are plain inline SVG drawn on the server: no script and no chart library.
laravel-trend
Posts per month
51 posts in the last six months, Trend::model(Post::query()).between(start, end).per_month().count().
Posts per day, last 30 days
The values
| Month | Posts |
|---|---|
| 2026-06 | 6.0 |
| 2026-07 | 8.0 |
| 2026-08 | 8.0 |
| 2026-09 | 9.0 |
| 2026-10 | 7.0 |
| 2026-11 | 9.0 |
| 2026-12 | 4.0 |
use laravel_trend::Trend;
let monthly = Trend::model(Post::query())
.between(six_months_ago, now)
.per_month()
.count()
.await?;
for value in monthly {
// "2026-11": 8
println!("{}: {}", value.date, value.aggregate);
}