diff --git a/src/Actions/SaveLog.php b/src/Actions/SaveLog.php index c627ac5..c4d95b2 100644 --- a/src/Actions/SaveLog.php +++ b/src/Actions/SaveLog.php @@ -36,6 +36,10 @@ public function dispatch() public function checkExpiredLogs() { + if(!config('larametrics')) { + return; + } + if(config('larametrics.logsWatchedExpireDays') !== 0) { LarametricsLog::where('created_at', '<', Carbon::now()->subDays(config('larametrics.logsWatchedExpireDays'))->toDateTimeString()) ->delete(); diff --git a/src/LarametricsEventsServiceProvider.php b/src/LarametricsEventsServiceProvider.php index 6ecdff0..c614e6b 100644 --- a/src/LarametricsEventsServiceProvider.php +++ b/src/LarametricsEventsServiceProvider.php @@ -25,6 +25,10 @@ public function boot() { parent::boot(); + if(!config('larametrics')) { + return; + } + foreach(config('larametrics.modelsWatched') as $model) { try { $model::observe(new ModelObserver());