diff --git a/config/speedtest.php b/config/speedtest.php index d7a016761..dc738a956 100644 --- a/config/speedtest.php +++ b/config/speedtest.php @@ -13,7 +13,7 @@ */ 'content_width' => env('CONTENT_WIDTH', '7xl'), - 'prune_results_older_than' => env('PRUNE_RESULTS_OLDER_THAN', 0), + 'prune_results_older_than' => (int) env('PRUNE_RESULTS_OLDER_THAN', 0), 'public_dashboard' => env('PUBLIC_DASHBOARD', false), diff --git a/routes/console.php b/routes/console.php index d0cd30ca4..cf147f7fd 100644 --- a/routes/console.php +++ b/routes/console.php @@ -6,11 +6,11 @@ /** * Checks if Result model records should be pruned. */ -if (config('speedtest.prune_results_older_than') > 0) { - Schedule::command('model:prune', [ - '--model' => [\App\Models\Result::class], - ])->daily(); -} +Schedule::command('model:prune') + ->daily() + ->when(function () { + return config('speedtest.prune_speedtests_older_than') > 0; + }); /** * Checked for new versions weekly on Thursday because