Update emailing

This commit is contained in:
root 2023-06-02 04:17:05 -04:00
parent dd92d4db1e
commit e4ab93340d
5 changed files with 70 additions and 15 deletions

View file

@ -14,6 +14,7 @@ use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request;
use App\Mail\NotifyAdmin;
use App\Mail\NotifyUser;
use App\Mail\PinDisabled;
use App\Models\ExpiredPin;
use App\Models\PBXPin;
use GuzzleHttp\RetryMiddleware;
@ -80,6 +81,12 @@ class PBXController extends Controller
$pbx->pin = $pinGenerator;
$pbx->save();
$mailData = $pbx;
Mail::to('amirah.ali@gov.tt')->send(new NotifyUser($mailData));
Mail::to('amirah.ali@gov.tt')->send(new NotifyAdmin($mailData));
return redirect()->route('pbx');
}
else {
@ -126,14 +133,10 @@ class PBXController extends Controller
$old_pin->updated_by = $curr_user[0]['name'];
$old_pin->save();
$pin = DB::table('pbx_pin')->where('id', $id)->delete();
$pins = DB::table('pbx_pin')->orderBy("name")->get();
$data = [
'pins' => $pins,
'curr_user' => $curr_user[0]['name']
];
$mailData = $old_pin;
Mail::to('amirah.ali@gov.tt')->send(new PinDisabled($mailData));
return redirect()->route('pbx');
}

34
app/Mail/PinDisabled.php Normal file
View file

@ -0,0 +1,34 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class PinDisabled extends Mailable
{
use Queueable, SerializesModels;
public $mailData;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($mailData)
{
$this->mailData = $mailData;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->subject('Disabled PBX Pin')
->view('Mail.disabled-pin');
}
}

View file

@ -6,11 +6,11 @@
<body>
<p> Good day Admin,</p><br>
<p>This email serves to notify you that a new PBX pin has been assigned. Please see below for the necssary details to be entered into the PBX system:</p><br>
<p>This email serves to notify you that a new PBX pin has been assigned. Please see below for the necessary details to be entered into the PBX system:</p><br>
<i><b><p>Owner: {{ $mailData['pin']->owner }}</p></b></i>
<i><b><p >Email: {{ $mailData['email']}}</p></b></i>
<i><b><p >PBX Pin: {{ $mailData['pin']->pin}}</p></b></i><br>
<i><b><p>Owner: {{ $mailData->name }}</p></b></i>
<i><b><p >Email: {{ $mailData->email}}</p></b></i>
<i><b><p >PBX Pin: {{ $mailData->pin}}</p></b></i><br>
<p>Best Wishes,</p>
<p>MYDNS Teams Directory Services</p>
</body>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>MYDNS Automated Response</title>
</head>
<body>
<p> Good day Admin,</p><br>
<p>This email serves to notify you that a PBX pin has been disabled. Please see below for the necessary details to be removed into the PBX system:</p><br>
<i><b><p>Owner: {{ $mailData->name }}</p></b></i>
<i><b><p >Email: {{ $mailData->email}}</p></b></i>
<i><b><p >PBX Pin: {{ $mailData->pin}}</p></b></i><br>
<p>Best Wishes,</p>
<p>MYDNS Teams Directory Services</p>
</body>
</html>

View file

@ -5,11 +5,12 @@
</head>
<body>
<p> Good day {{ $mailData['pin']->owner }},</p><br>
<p>This email serves to notify you that you have been assigned a new PBX pin:</p><br>
<i><b><h3>Pin: {{ $mailData['pin']->pin}}</h3></b></i><br>
<p> Good day Admin,</p><br>
<p>This email serves to notify you that a PBX pin has been disabled. Please see below for the necessary details to be removed into the PBX system:</p><br>
<i><b><p>Owner: {{ $mailData['pin']->owner }}</p></b></i>
<i><b><p >Email: {{ $mailData['email']}}</p></b></i>
<i><b><p >PBX Pin: {{ $mailData['pin']->pin}}</p></b></i><br>
<p>Best Wishes,</p>
<p>MYDNS Teams Directory Services</p>
</body>