vito/app/Console/Commands/ClearLogsCommand.php
2025-02-27 22:19:50 +01:00

27 lines
553 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\ServerLog;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
class ClearLogsCommand extends Command
{
protected $signature = 'logs:clear';
protected $description = 'Clear all server logs';
public function handle(): void
{
$this->info('Clearing logs...');
ServerLog::query()->delete();
File::cleanDirectory(Storage::disk('server-logs')->path(''));
$this->info('Logs cleared!');
}
}