Merged main into amir_dev_2

This commit is contained in:
Amir Hassan Hamzan
2023-06-19 02:42:46 +00:00
6 changed files with 191 additions and 2 deletions
+10 -2
View File
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Jobs\NotifyJanaNotis;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
@@ -40,8 +41,6 @@ use App\Models\WtdDraft;
use App\Jobs\WhatsappNotisLelongFasa1;
use App\Jobs\WhatsappNotisLelongFasa2;
class NotisController extends Controller
{
/**
@@ -280,6 +279,11 @@ class NotisController extends Controller
$currentdate = Carbon::now();
$tarikh_cetak = $currentdate->toDateString();
$current_date_time = $currentdate->toDateTimeString();
Log::info("Jana notis fasa 1: " . $user->kodcaw . ", " . $user->name);
NotifyJanaNotis::dispatch($user->id, $user->kodcaw, $user->name, 'Jana Notis Fasa 1', $current_date_time);
$lelongid = Lelong::find($lelong_id);
$arraynorujukan = LelongBid::where('lelong_id', $lelong_id)->where('kodcaw', $caw->caw_code)->pluck('norujukan');
@@ -591,6 +595,10 @@ class NotisController extends Controller
// dd($marhuns);
$arraysag = [];
$current_date_time = $current->toDateTimeString();
Log::info("Jana notis fasa 2: " . $user->kodcaw . ", " . $user->name);
NotifyJanaNotis::dispatch($user->id, $user->kodcaw, $user->name, 'Jana Notis Fasa 2', $current_date_time);
foreach($marhuns as $index1=>$cal){
$customer = Customer::where('kpbaru','=',$cal['nokp'])
+61
View File
@@ -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));
}
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class NotifyAdmin extends Mailable
{
use Queueable, SerializesModels;
public $content_collection;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($content_collection)
{
$this->content_collection = $content_collection;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->from("masterlelongpkb@gmail.com", "Admin ArrahnBid")
->subject('ArrahnBid - ' . $this->content_collection['description'])
->view('template.notifyadmin', ['content_collection' => $this->content_collection]);
}
}