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

namespace AppConsoleCommands;

use 
AppModelsPolling;
use 
IlluminateConsoleCommand;

class 
DeletePolling extends Command
{
    
/**
     * The name and signature of the console command.
     *
     * @var string
     */
    
protected $signature 'delete:polling';

    
/**
     * The console command description.
     *
     * @var string
     */
    
protected $description 'Delete polling';

    
/**
     * Create a new command instance.
     *
     * @return void
     */
    
public function __construct()
    {
        
parent::__construct();
    }

    
/**
     * Удаляет старые записи голосов
     *
     * @return int
     */
    
public function handle()
    {
        
Polling::query()
            ->
where('created_at''<'strtotime('-1 year'SITETIME))
            ->
delete();

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

        return 
0;
    }
}
Онлайн: 3
Реклама