Recording Deletions
Publish a removal activity before deleting its model. The activity remains, with a tombstone in place of the model. The tombstone records the model's former type and deletion time.
Recording a Deletion
php
Storyfeed::activity()
->by($request->user())
->action('remove', $product)
->to($menu)
->publish();
$product->delete(); php
Storyfeed::record(
verb: 'remove',
object: $product,
target: $menu,
actor: $request->user(),
);
$product->delete(); php
use App\Models\MenuItem;
use Storyfeed\ActivityStreams\ActivityType;
use Storyfeed\Facades\Story;
Story::for(MenuItem::class)
->verb('remove')
->headline(':actor removed :object from :target')
->type(ActivityType::Remove); // a removal verb keeps its headline after the deleteSH
Steve Harrington removed a removed menu item from Scoops Ahoy
Choosing What Stays
Other activities involving the menu item also remain with its tombstone. See Deleted Models for their headlines and payloads.
| To | Use |
|---|---|
| keep the deleted model's label in earlier activities | keepLabel() on its tombstone |
| remove activities made redundant by permanent deletion | forgetWhenMissing() on those verbs |
| remove all activities involving a model, such as when a customer asks to be forgotten | deleteFromFeed() or forceDeleteFromFeed() before deleting the model |