mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 09:51:37 +00:00
Add logs:clear command (#509)
This commit is contained in:
parent
f54c754971
commit
d8ece27964
26
app/Console/Commands/ClearLogsCommand.php
Normal file
26
app/Console/Commands/ClearLogsCommand.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?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!');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user