Skip to content

zingimmick/laravel-eloquent-blameable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Track the creator and updater for Laravel eloquent

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages