Skip to content
Icon

WARNING You're browsing the documentation for an old version of LARAVEL-AUDITABLE. Consider upgrading your project to laravel-auditable 4.0.

Auditable Trait

Using AuditableTrait trait on your model will give you the following api.

Creator

Get the instance of the User who created the record.

$post = Post::first();
$creator = $post->creator;

Updater

Get the instance of the User who last updated the record.

$post = Post::first();
$updater = $post->updater;

Owned Scope

A query scope that limits the results to a list of records that the current user owned.

auth()->loginUsingId(1);
 
$posts = Post::owned()->get();