Add feature notify admin when download pdf
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Mail\NotifyAdmin;
|
||||
use App\Mail\NotifyJanaNotis as MailNotifyJanaNotis;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class NotifyJanaNotis implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_id;
|
||||
public $user_kodcaw;
|
||||
private $user_name;
|
||||
private $description;
|
||||
private $date_time;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_id, $user_kodcaw, $user_name, $description, $date_time)
|
||||
{
|
||||
$this->user_id = $user_id;
|
||||
$this->user_kodcaw = $user_kodcaw;
|
||||
$this->user_name = $user_name;
|
||||
$this->description = $description;
|
||||
$this->date_time = $date_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$content_collection = collect();
|
||||
$content_collection['user_id'] = $this->user_id;
|
||||
$content_collection['user_kodcaw'] = $this->user_kodcaw;
|
||||
$content_collection['user_name'] = $this->user_name;
|
||||
$content_collection['description'] = $this->description;
|
||||
$content_collection['download_time'] = $this->date_time;
|
||||
|
||||
$admin_emails = explode(',', config('app.admin_email'));
|
||||
|
||||
foreach($admin_emails as $email) {
|
||||
Mail::to($email)->send(new NotifyAdmin($content_collection));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user