Spatie\Activitylog\Traits\LogsActivity::bootLogsActivity PHP Method

bootLogsActivity() protected static method

protected static bootLogsActivity ( )
    protected static function bootLogsActivity()
    {
        static::eventsToBeRecorded()->each(function ($eventName) {
            return static::$eventName(function (Model $model) use($eventName) {
                if (!$model->shouldLogEvent($eventName)) {
                    return;
                }
                $description = $model->getDescriptionForEvent($eventName);
                $logName = $model->getLogNameToUse($eventName);
                if ($description == '') {
                    return;
                }
                app(ActivityLogger::class)->useLog($logName)->performedOn($model)->withProperties($model->attributeValuesToBeLogged($eventName))->log($description);
            });
        });
    }