- Mengambil informasi pengguna yang sedang login. - Menyimpan informasi pengguna dalam job pengiriman email. - Mengupdate tampilan email untuk menampilkan informasi pengguna.
60 lines
1.7 KiB
PHP
60 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Modules\Lpj\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 Modules\Lpj\Emails\SendPenawaranTenderEmail;
|
|
|
|
class SendPenawaranTenderJob implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
protected $kjpps;
|
|
protected $penawaran;
|
|
protected $permohonan;
|
|
protected $villages;
|
|
protected $districts;
|
|
protected $cities;
|
|
protected $provinces;
|
|
protected $user; // Tidak perlu array [0] lagi
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*/
|
|
public function __construct($kjpps, $penawaran, $permohonan, $villages, $districts, $cities, $provinces,$user)
|
|
{
|
|
$this->kjpps = $kjpps;
|
|
$this->penawaran = $penawaran;
|
|
$this->permohonan = $permohonan;
|
|
$this->villages = $villages;
|
|
$this->districts = $districts;
|
|
$this->cities = $cities;
|
|
$this->provinces = $provinces;
|
|
$this->user = $user; // Simpan user yang dikirim email ke properti
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
$email = new SendPenawaranTenderEmail();
|
|
$email->with([
|
|
'penawaran' => $this->penawaran,
|
|
'permohonan' => $this->permohonan,
|
|
'villages' => $this->villages,
|
|
'districts' => $this->districts,
|
|
'cities' => $this->cities,
|
|
'provinces' => $this->provinces,
|
|
'user' => $this->user // Kirim user ke email ke properti sebagai additional data
|
|
]);
|
|
|
|
Mail::to($this->kjpps)->send($email);
|
|
}
|
|
}
|