Headlines for Grouped Activities
An order can be placed more than once. A headline that calls every placement an order overstates how many orders there are. Keep the events, and choose wording that counts what actually happened.
Counting Placements of the Same Order
Suppose a customer places an order, then places it again after an amendment. Keep both occurrences so the feed can explain what happened. These are two place activities about one order:
| What Is Counted | Value |
|---|---|
placement activities (count) | 2 |
distinct orders (distinct.objects) | 1 |
:count counts activities. It cannot turn the two placements into a distinct order count. In this case, “placed 2 orders” would be wrong.
Wording the Group Headline
Both placements share an actor, verb, object and day, so the default object axis groups them. Name the shared order and count how many times it was placed. For a repeat group across orders, call the events “order placements”:
use App\Models\Order;
use Storyfeed\Facades\Story;
use Storyfeed\Grouping\GroupBuilder;
Story::for(Order::class)->verb('place')
->headline(':actor placed :object with :target')
->grouped(
fn (GroupBuilder $group): GroupBuilder => $group
->object(':actor placed :object :count times')
->repeat(':actor made :count order placements with :target'),
);The same two activities now have a headline that describes their group:
For the declaration table, type and verb scope, and allowed tokens, see Defining Group Headlines.
Keeping Individual Content Visible
A group headline describes the events together; it does not replace their individual content. Quotes, images and other bodies remain on the member activities. To show every placement as its own row, retrieve the order's placements in log mode:
use Storyfeed\Facades\Storyfeed;
$placements = Storyfeed::feed()
->involving($order)
->only(['place'])
->log()
->get();That returns the separate rows shown above. Keep their bodies beside their individual headlines instead of folding them into the group sentence.