Pre-1.0. Not intended for public use yet. The API is subject to undocumented change, and these pages may already be wrong about it.

Skip to content

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(); 
routes/feed.php
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 delete
SH
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.

ToUse
keep the deleted model's label in earlier activitieskeepLabel() on its tombstone
remove activities made redundant by permanent deletionforgetWhenMissing() on those verbs
remove all activities involving a model, such as when a customer asks to be forgottendeleteFromFeed() or forceDeleteFromFeed() before deleting the model

Released under the MIT License.