<?php

namespace App\Traits;

trait Blameable {
  
  public static function bootBlameable() {
    static::creating(function ($model) {
        $model->created_by = auth()->id() ?? NULL;
        $model->updated_by = auth()->id() ?? NULL;
    });

    static::updating(function ($model) {
        $model->updated_by = auth()->id() ?? NULL;
    });

    static::deleting((function ($model) {
        $model->deleted_by = auth()->id() ?? NULL;
    }));
  }
  
}
