Вход Регистрация
Файл: app/Console/Commands/DeletePolls.php
Строк: 36
<?php

namespace AppConsoleCommands;

use 
AppModelsPoll;
use 
IlluminateConsoleCommand;
use 
SymfonyComponentConsoleCommandCommand as SymfonyCommand;

class 
DeletePolls extends Command
{
    
/**
     * The name and signature of the console command.
     */
    
protected $signature 'delete:polls';

    
/**
     * The console command description.
     */
    
protected $description 'Delete polls';

    
/**
     * Удаляет старые записи голосов
     */
    
public function handle(): int
    
{
        
Poll::query()
            ->
where('created_at''<'now()->subYear())
            ->
delete();

        
$this->info('Polls successfully deleted.');

        return 
SymfonyCommand::SUCCESS;
    }
}
Онлайн: 1
Реклама