Skip to content

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();