<?php
namespace App\Http\Controllers\Form;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;

use App\Mail\CustomerInvoice;
use App\Jobs\SendCustomerInvoice;

use Carbon\Carbon;
use Validator;
use File;

use App\Model\Coverage;
use App\Model\Product;

use App\Model\Form;
use App\Model\Subscriber;
use App\Model\PackageDetail;
use App\Model\FormStatus;

class FormController extends Controller
{
	public function updateStatus($f_id){
		$fm = Form::where('_id',$f_id)->first();
		if(!empty($fm)){
			$fm->status_email = 'verified';
			$fm->save();

    		$formH = new FormStatus;
    		$formH->form_id = $fm->_id;
			$formH->status_id = 2;
			$formH->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
			$formH->status = 'Verified';
			$formH->desc = 'Email already been verified by Customer Service';

			$fm->formstatus()->save($formH);
			return redirect('/customer-service/new/customer/list');
		}
	}
}