Looking to hire Laravel developers? Try LaraJobs

laravel-eloquent-blameable maintained by zing

Description
Track the creator and updater for Laravel eloquent
Author
Last update
2026/03/18 17:07 (3.x-dev)
License
Downloads
24

Comments
comments powered by Disqus

Laravel Eloquent Blameable

Latest Stable Version Total Downloads Latest Unstable Version License

Requirements

Require Laravel Eloquent Blameable using Composer:

composer require zing/laravel-eloquent-blameable

Usage

<?php

use Illuminate\Database\Eloquent\Model;
use Zing\LaravelEloquentBlameable\Blameable;

class Content extends Model
{
    use Blameable;
}

Custom creator key name or updater key name

<?php

use Illuminate\Database\Eloquent\Model;
use Zing\LaravelEloquentBlameable\Blameable;

class Content extends Model
{
    use Blameable;

    public function getCreatorKeyName(): string
    {
        return 'created_by';
    }

    public function getUpdaterKeyName(): string
    {
        return 'updated_by';
    }
}

Model without updater

<?php

use Illuminate\Database\Eloquent\Model;
use Zing\LaravelEloquentBlameable\Blameable;

class Content extends Model
{
    use Blameable;

    public function getCreatorKeyName(): string
    {
        return 'created_by';
    }

    public function getUpdaterKeyName(): ?string
    {
        return null;
    }
}

License

Laravel Eloquent Blameable is an open-sourced software licensed under the MIT license.