<?php
namespace App\Models\StockManagement\Bootables;


use Illuminate\Database\Eloquent\Model;

trait Authorable{


    public static function bootAuthorable(){

        static::creating(function (Model $model) {
            if (auth()->check()){
                $model->setAttribute("created_by",auth()->id());
            }
        });

        static::updating(function (Model $model) {
            if (auth()->check()){
                $model->setAttribute("updated_by",auth()->id());
            }
        });
    }
}
