<?php

namespace App\Console\Commands;

use App\Repositries\AuctionRepository;
use Illuminate\Console\Command;

class EndTheExpiredAuctions extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'expire:auction';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Change The Type Of Expired Auctions That Past The Expire Date And Time To Past';

    /**
     * Execute the console command.
     */
    public function handle(AuctionRepository $auctionRepository)
    {

        $auctions = $auctionRepository->expired();


        foreach ($auctions as $auction)
            $auctionRepository->update($auction->id, ['type' => 'past']);
    }
}
