Skip to content

Instantly share code, notes, and snippets.

@victorsteven
Created April 15, 2019 16:52
Show Gist options
  • Save victorsteven/0fbd9e77d043880c55689dcf980c0e64 to your computer and use it in GitHub Desktop.
Save victorsteven/0fbd9e77d043880c55689dcf980c0e64 to your computer and use it in GitHub Desktop.
SendMailJob file
<?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 Mail;
class SendMailJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
protected $email;
protected $emailClass;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($email, $emailClass)
{
$this->email = $email;
$this->emailClass= $emailClass;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Mail::to($this->email)->send($this->emailClass);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment