18 lines
No EOL
411 B
PHP
18 lines
No EOL
411 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
trait HasCreatorAndUpdater {
|
|
protected static function bootHasCreatorAndUpdater() {
|
|
static::creating(function($model) {
|
|
$model->created_by = Auth::id();
|
|
$model->updated_by = Auth::id();
|
|
});
|
|
|
|
static::updating(function($model) {
|
|
$model->updated_by = Auth::id();
|
|
});
|
|
}
|
|
} |