'array', 'created_at' => 'datetime', ]; public static function record(string $action, Model $model, array $changes = []): void { static::create([ 'action' => $action, 'model_type' => class_basename($model), 'model_id' => $model->getKey(), 'user_id' => Auth::id(), 'changes' => empty($changes) ? null : $changes, 'created_at' => now(), ]); } public function user() { return $this->belongsTo(User::class); } }