<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Carbon\Carbon;
use App\Console\Commands\AbstractCommand;

class HolidayTesting extends AbstractCommand
{
    /**
     * A friendly name of the command that will be used when loggin messages.
     *
     * @var string
     */
    protected $command_title = 'Holiday Testing';

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'holiday:test';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Checks the predefined mailbox for new emails and creates a new task automatically.';

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

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        $d1  = '27/1/2017';
        $d2  = '10/02/2017';
        
        $format = 'd/m/Y';
        
        $myStartDate = Carbon::createFromFormat($format, $d1);
        $myEndDate = Carbon::createFromFormat($format, $d2);
       
        
        $totalDays = $myStartDate->diffInDays($myEndDate);

        $counter = 0;

        while($myStartDate <= $myEndDate)
        {
            if($myStartDate->isWeekday()) {
                $this->info('Weekday:'.$myStartDate);
                $counter++;
            }
            else
            {
                $this->error('Weekend:'.$myStartDate);

            }
            $myStartDate->addDay();
        }        
    }
}
