<?php

namespace App\Console\Commands;


use Carbon\Carbon;
use Illuminate\Console\Command;
use DB;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redirect;
use Portal\Ecuti\Model\VwMainAppVerify;
use Portal\Ecuti\Model\VwMainAppApproval;
use Portal\Ecuti\Model\MainApp;
use Portal\Ecuti\Model\AppFdCartaMain;
use App\User;
use Mail;





class NotifyPlan extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'schedule:notify-plan';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Send Notification to verifier(status 12)';
    
 

    /**
     * Create a new command instance.
     *
     * @return void
     */
   /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
            


            $approvallist = MainApp::where('status', '=', 12)->get();
            $count = 0;

            foreach ($approvallist as $key => $value) 
            {
                   $mainappid = $value->id;
                   $approvalid = $value->approved_by;

                   event(new \Portal\Ecuti\Events\NotifyEmail($approvalid,16,$mainappid)); 

                   $count=$count+1;
            
            }

            return 'Resend Total = '.$count;

              
                  

    }
}

