PHPackages                             jeffersongoncalves/laravel-created-by - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jeffersongoncalves/laravel-created-by

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jeffersongoncalves/laravel-created-by
=====================================

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.

v1.1.2(2mo ago)240↓100%1MITPHPPHP ^8.2|^8.3CI passing

Since Mar 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/jeffersongoncalves/laravel-created-by)[ Packagist](https://packagist.org/packages/jeffersongoncalves/laravel-created-by)[ Docs](https://github.com/jeffersongoncalves/laravel-created-by)[ RSS](/packages/jeffersongoncalves-laravel-created-by/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (6)Used By (0)

[![Laravel Created By](https://raw.githubusercontent.com/jeffersongoncalves/laravel-created-by/master/art/jeffersongoncalves-laravel-created-by.png)](https://raw.githubusercontent.com/jeffersongoncalves/laravel-created-by/master/art/jeffersongoncalves-laravel-created-by.png)

Laravel Created By
==================

[](#laravel-created-by)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6f5bde63be567e318f8fa6a7910095649335a1414b17ab35b3b13bc9b0196e19/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d637265617465642d62792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-created-by)[![GitHub Tests Action Status](https://camo.githubusercontent.com/eabe2ffaafdd16f72f8faa1935fa0f35f32ce023a29da67630a6124fae8b3d16/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d637265617465642d62792f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-created-by/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/395bacd22970e6ba64f64faafc1f79f0956b4aa532c30f4f5a48d932011a1d8c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d637265617465642d62792f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-created-by/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/3586cd462a54dc2037f5f2a77b1233a0a980e21eae0a65347e19bb0666d83556/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d637265617465642d62792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-created-by)

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
------------

[](#installation)

You can install the package via composer:

```
composer require jeffersongoncalves/laravel-created-by
```

Usage
-----

[](#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:

```
