PHPackages                             laravel-appkit/blameable - 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. laravel-appkit/blameable

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

laravel-appkit/blameable
========================

v1.2.0(1y ago)03.9k↓33.3%1[2 PRs](https://github.com/laravel-appkit/blameable/pulls)MITPHPPHP ^7.4|^8.0CI passing

Since Jan 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/laravel-appkit/blameable)[ Packagist](https://packagist.org/packages/laravel-appkit/blameable)[ Docs](https://github.com/laravel-appkit/blameable)[ RSS](/packages/laravel-appkit-blameable/feed)WikiDiscussions main Synced 1mo ago

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

Eloquent Blameable
==================

[](#eloquent-blameable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0449a73607756bc3531d8df9fcd8cd2693bf230defef95d1d1fe41c06940a0c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6170706b69742f626c616d6561626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-appkit/blameable)[![Build Status](https://camo.githubusercontent.com/4033e5de8b224b67eb190eee7980bc053de399856dbade4ab4a50947955a502f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c61726176656c2d6170706b69742f626c616d6561626c652f72756e2d74657374732e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/laravel-appkit/blameable/actions?query=workflow%3A%22Automated+Tests%22)[![Quality Score](https://camo.githubusercontent.com/011d53f621e4b4d10beaf948614df1b7b778073029e87f415e476794fe799312/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c61726176656c2d6170706b69742f626c616d6561626c652f636f64696e672d7374616e64617264732e796d6c3f6c6162656c3d636f64652532307175616c697479267374796c653d666c61742d737175617265)](https://github.com/laravel-appkit/blameable/actions?query=workflow%3A%22Check+%26+fix+styling%22)[![Total Downloads](https://camo.githubusercontent.com/248221d8570a2d2a297ade2b10028c12799ee8e181ed95cd5302ea5bce8e414c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6170706b69742f626c616d6561626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-appkit/blameable)[![Licence](https://camo.githubusercontent.com/fc73673d83beeb1d83ab835a0431c8c1f7cee36f83accb3316b0c10b55c2848e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c61726176656c2d6170706b69742f626c616d6561626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-appkit/blameable)[![codecov](https://camo.githubusercontent.com/db7fdbe5fbfbc40c381387bc3eb4f234c59a1a1aa1a87cf44f1ace92dded0eb7/68747470733a2f2f636f6465636f762e696f2f67682f6c61726176656c2d6170706b69742f626c616d6561626c652f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/laravel-appkit/blameable)

This package allows you to store the creator (`created_by`) and last editor (`edited_by`) of an Eloquent Model. You can also store the user who soft deleted a model.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require laravel-appkit/blameable
```

Usage
-----

[](#usage)

First, add the `created_at`, `updated_at` (and optionally `deleted_at`) columns to your table. This can be done via the `blameable` method in your migration.

```
Schema::create('articles', function (Blueprint $table) {
    $table->increments('id');
    $table->string('title');
    $table->text('body');
    $table->timestamps();

    // add this line to create the columns
    $table->blameable(); // pass in true as the first argument to enable soft deletes columns
});
```

Next, add the `AppKit\Blameable\Traits\Blameable` trait to the model

```
