Posts Module Iteration Grouping
Created 1 year ago by carsonsuite

Hey! I wanted to use a custom datepicker FT for a post type. When iterating over posts, how can I group posts of equal dates?

sudo: IF previous date == current date Is it possible to get previous date after it's has been passed in the iteration?

ryanthompson  —  1 year ago Best Answer

You can .groupBy('DATE(publish_at)') I think. But the query criteria gives you pretty much full access to Laravel's query builder.

If all else fails you can pass it to a controller OR use a custom plugin 😄

Also you can {% set last = post %} at the end of your loop to basically have the "last" post available above this line.