Require Laravel Eloquent Blameable using Composer:
composer require zing/laravel-eloquent-blameable
<?php
use Illuminate\Database\Eloquent\Model;
use Zing\LaravelEloquentBlameable\Blameable;
class Content extends Model
{
use Blameable;
}
<?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';
}
}
<?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;
}
}
Laravel Eloquent Blameable is an open-sourced software licensed under the MIT license.