Menambahkan fitur kirim email tender part 1
This commit is contained in:
67
app/Jobs/SendPenawaranKJPPTenderJob.php
Normal file
67
app/Jobs/SendPenawaranKJPPTenderJob.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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\SendPenawaranKJPPEmail;
|
||||
|
||||
class SendPenawaranKJPPTenderJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $kjpps;
|
||||
protected $dp1; // Tidak perlu array [0] lagi
|
||||
protected $penawaran;
|
||||
protected $permohonan;
|
||||
protected $villages;
|
||||
protected $districts;
|
||||
protected $cities;
|
||||
protected $provinces;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct($kjpps, $dp1, $penawaran, $permohonan, $villages, $districts, $cities, $provinces)
|
||||
{
|
||||
$this->kjpps = $kjpps;
|
||||
$this->dp1 = $dp1; // Simpan keseluruhan array dp1, bukan dp1[0]
|
||||
$this->penawaran = $penawaran;
|
||||
$this->permohonan = $permohonan;
|
||||
$this->villages = $villages;
|
||||
$this->districts = $districts;
|
||||
$this->cities = $cities;
|
||||
$this->provinces = $provinces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$email = new SendPenawaranKJPPEmail(
|
||||
$this->dp1,
|
||||
$this->penawaran,
|
||||
$this->permohonan,
|
||||
$this->villages,
|
||||
$this->districts,
|
||||
$this->cities,
|
||||
$this->provinces
|
||||
);
|
||||
$email->with([
|
||||
'dp1' => $this->dp1, // Kirim seluruh array dp1 ke email
|
||||
'penawaran' => $this->penawaran,
|
||||
'permohonan' => $this->permohonan,
|
||||
'villages' => $this->villages,
|
||||
'districts' => $this->districts,
|
||||
'cities' => $this->cities,
|
||||
'provinces' => $this->provinces,
|
||||
]);
|
||||
|
||||
Mail::to($this->kjpps)->send($email);
|
||||
}
|
||||
}
|
||||
56
app/Jobs/SendPenawaranTenderJob.php
Normal file
56
app/Jobs/SendPenawaranTenderJob.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct($kjpps, $penawaran, $permohonan, $villages, $districts, $cities, $provinces)
|
||||
{
|
||||
$this->kjpps = $kjpps;
|
||||
$this->penawaran = $penawaran;
|
||||
$this->permohonan = $permohonan;
|
||||
$this->villages = $villages;
|
||||
$this->districts = $districts;
|
||||
$this->cities = $cities;
|
||||
$this->provinces = $provinces;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
]);
|
||||
|
||||
Mail::to($this->kjpps)->send($email);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user