This is the documentation for
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-activitylog
This class is registered as singleton and allows you to batch activities. Once captured as a batch these activities can be pulled back up as a group.
LogBatch::getUuid(); // 15c72460-4998-49ac-a0a3-647cc6f312ef
$log = activity()->log('log look mom, I did something...');
$author = Author::first();
$author->delete(); // deletes books too
// Author Deleted, batch_uuid: 15c72460-4998-49ac-a0a3-647cc6f312ef
// Book 1 Deleted, batch_uuid: 15c72460-4998-49ac-a0a3-647cc6f312ef
// Book 2 Deleted, batch_uuid: 15c72460-4998-49ac-a0a3-647cc6f312ef
// log look mom, I did something..., batch_uuid: 15c72460-4998-49ac-a0a3-647cc6f312ef
$log->batch_uuid; // 15c72460-4998-49ac-a0a3-647cc6f312ef
public function startBatch(): void;
* Check if there's an open batch
public function isOpen(): bool;
* Set uuid for the current open batch, it can be used to keep the batch
* open throughout multiple requests or in a batch queue job.
public function setBatch(string $uuid): void;
public function endBatch(): void;
* Start new batch, execute the callback passed in uuid, end the batch.
public function withinBatch(Closure $callback): mixed;