Файл: app/Console/Commands/DeleteErrors.php
Строк: 37
<?php
namespace AppConsoleCommands;
use AppModelsError;
use IlluminateConsoleCommand;
use SymfonyComponentConsoleCommandCommand as SymfonyCommand;
class DeleteErrors extends Command
{
/**
* The name and signature of the console command.
*/
protected $signature = 'delete:errors';
/**
* The console command description.
*/
protected $description = 'Delete error logs';
/**
* Удаляет старые записи логов ошибок
*/
public function handle(): int
{
Error::query()
->where('created_at', '<', now()->subMonth())
->delete();
$this->info('Errors successfully deleted.');
return SymfonyCommand::SUCCESS;
}
}