60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Mail\ReportEmail;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
class SendReport implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
/**
|
|
* @var
|
|
*/
|
|
protected $user;
|
|
protected $type;
|
|
protected $reportedFor;
|
|
protected $reportSubject;
|
|
protected $description;
|
|
|
|
/**
|
|
* SendReport constructor.
|
|
* @param $user
|
|
* @param $type
|
|
* @param $reportedFor
|
|
* @param $reportSubject
|
|
* @param $description
|
|
*/
|
|
public function __construct($user, $type, $reportedFor, $reportSubject, $description)
|
|
{
|
|
$this->user = $user;
|
|
$this->type = $type;
|
|
$this->reportedFor = $reportedFor;
|
|
$this->reportSubject = $reportSubject;
|
|
$this->description = $description;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
try {
|
|
$email = new ReportEmail($this->user, $this->type, $this->reportedFor, $this->reportSubject, $this->description);
|
|
Mail::to('connect@globaljain.net')->queue($email);
|
|
|
|
} catch (\Exception $ex) {
|
|
Log::error($ex);
|
|
}
|
|
}
|
|
}
|