Update emailing
This commit is contained in:
parent
dd92d4db1e
commit
e4ab93340d
|
|
@ -14,6 +14,7 @@ use Illuminate\Support\Facades\Session;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Mail\NotifyAdmin;
|
use App\Mail\NotifyAdmin;
|
||||||
use App\Mail\NotifyUser;
|
use App\Mail\NotifyUser;
|
||||||
|
use App\Mail\PinDisabled;
|
||||||
use App\Models\ExpiredPin;
|
use App\Models\ExpiredPin;
|
||||||
use App\Models\PBXPin;
|
use App\Models\PBXPin;
|
||||||
use GuzzleHttp\RetryMiddleware;
|
use GuzzleHttp\RetryMiddleware;
|
||||||
|
|
@ -80,6 +81,12 @@ class PBXController extends Controller
|
||||||
$pbx->pin = $pinGenerator;
|
$pbx->pin = $pinGenerator;
|
||||||
|
|
||||||
$pbx->save();
|
$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');
|
return redirect()->route('pbx');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -126,14 +133,10 @@ class PBXController extends Controller
|
||||||
$old_pin->updated_by = $curr_user[0]['name'];
|
$old_pin->updated_by = $curr_user[0]['name'];
|
||||||
|
|
||||||
$old_pin->save();
|
$old_pin->save();
|
||||||
|
|
||||||
$pin = DB::table('pbx_pin')->where('id', $id)->delete();
|
$pin = DB::table('pbx_pin')->where('id', $id)->delete();
|
||||||
$pins = DB::table('pbx_pin')->orderBy("name")->get();
|
|
||||||
|
$mailData = $old_pin;
|
||||||
$data = [
|
Mail::to('amirah.ali@gov.tt')->send(new PinDisabled($mailData));
|
||||||
'pins' => $pins,
|
|
||||||
'curr_user' => $curr_user[0]['name']
|
|
||||||
];
|
|
||||||
|
|
||||||
return redirect()->route('pbx');
|
return redirect()->route('pbx');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
app/Mail/PinDisabled.php
Normal file
34
app/Mail/PinDisabled.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<p> Good day Admin,</p><br>
|
<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>Owner: {{ $mailData->name }}</p></b></i>
|
||||||
<i><b><p >Email: {{ $mailData['email']}}</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 >PBX Pin: {{ $mailData->pin}}</p></b></i><br>
|
||||||
<p>Best Wishes,</p>
|
<p>Best Wishes,</p>
|
||||||
<p>MYDNS Teams Directory Services</p>
|
<p>MYDNS Teams Directory Services</p>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
17
resources/views/Mail/disabled-pin.blade.php
Normal file
17
resources/views/Mail/disabled-pin.blade.php
Normal 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>
|
||||||
|
|
@ -5,11 +5,12 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<p> Good day {{ $mailData['pin']->owner }},</p><br>
|
<p> Good day Admin,</p><br>
|
||||||
<p>This email serves to notify you that you have been assigned a new PBX pin:</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><h3>Pin: {{ $mailData['pin']->pin}}</h3></b></i><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>Best Wishes,</p>
|
||||||
<p>MYDNS Teams Directory Services</p>
|
<p>MYDNS Teams Directory Services</p>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue