<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Mail;
use Exception;

use App\Mail\CustomerBInvoice;
use App\Model\Form;
use App\Model\Product;
use App\Model\Subscriber;

class SendCustomerInvoiceB implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    public $form,$recipient,$product;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(Form $form, Product $product, $recipient)
    {
        //
        $this->form = $form;
        $this->recipient = $recipient;
        $this->product = $product;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        //
        Mail::to($this->recipient)->send(new CustomerBInvoice($this->form,$this->product));
    }

    public function failed(Exception $exception)
    {
        //
    }
}
