Looking to hire Laravel developers? Try LaraJobs

laravel-created-by maintained by jeffersongoncalves

Description
This Laravel package automatically logs the currently logged-in user's ID to the `created_by`, `updated_by`, `deleted_by`, and `restored_by` fields of your Eloquent models. It also automatically timestamps the `restored_at` field when a model is restored. This simplifies the tracking of data modifications and provides valuable auditing capabilities. The package is easy to install and configure, seamlessly integrating with your existing Laravel application.
Last update
2026/04/02 16:35 (dev-master)
License
Downloads
78

Comments
comments powered by Disqus

Laravel Created By

Laravel Created By

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This Laravel package automatically logs the currently logged-in user's ID to the created_by, updated_by, deleted_by, and restored_by fields of your Eloquent models. It also automatically timestamps the restored_at field when a model is restored. This simplifies the tracking of data modifications and provides valuable auditing capabilities. The package is easy to install and configure, seamlessly integrating with your existing Laravel application.

Installation

You can install the package via composer:

composer require jeffersongoncalves/laravel-created-by

Usage

Add in columns our table.

Schema::create('posts', function (Blueprint $table) {
    $table->createdBy();
    $table->updatedBy();
    $table->deletedBy();
    $table->restoredBy();
    $table->restoredAt();
    $table->softDeletes();
});

Your model add traits:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use JeffersonGoncalves\CreatedBy\WithCreatedBy;
use JeffersonGoncalves\CreatedBy\WithUpdatedBy;
use JeffersonGoncalves\CreatedBy\WithDeletedBy;
use JeffersonGoncalves\CreatedBy\WithRestoredBy;
use JeffersonGoncalves\CreatedBy\WithRestoredAt;

class Post extends Model
{
    use SoftDeletes;
    use WithCreatedBy;
    use WithUpdatedBy;
    use WithDeletedBy;
    use WithRestoredBy;
    use WithRestoredAt;
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.