email comes through, no picture and html markup appear though.
This commit is contained in:
parent
9f06a0e441
commit
3ab2521cb0
5 changed files with 100 additions and 99 deletions
|
@ -338,4 +338,5 @@ class AcceptanceController extends Controller
|
|||
return redirect()->to('account/accept')->with('success', $return_msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ class CheckoutableListener
|
|||
$event->checkoutable,
|
||||
$event->checkedOutTo,
|
||||
$event->checkedOutBy,
|
||||
$event->note,
|
||||
$acceptance,
|
||||
$event->note
|
||||
));
|
||||
|
||||
// Send email notifications
|
||||
|
@ -61,18 +61,18 @@ class CheckoutableListener
|
|||
$mailable->locale($event->checkedOutTo->locale);
|
||||
}
|
||||
Mail::to($notifiable)->send($mailable);
|
||||
\Log::info('Sending email, Locale: ' .($event->checkedOutTo->locale ?? 'default'));
|
||||
Log::info('Sending email, Locale: ' .($event->checkedOutTo->locale ?? 'default'));
|
||||
// Send Webhook notification
|
||||
if ($this->shouldSendWebhookNotification()) {
|
||||
// Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint
|
||||
if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') {
|
||||
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
|
||||
->notify($this->getCheckoutNotification($event, $acceptance));
|
||||
} else {
|
||||
Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
|
||||
->notify($this->getCheckoutNotification($event, $acceptance));
|
||||
}
|
||||
}
|
||||
// if ($this->shouldSendWebhookNotification()) {
|
||||
// // Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint
|
||||
// if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') {
|
||||
// Notification::route('slack', Setting::getSettings()->webhook_endpoint)
|
||||
// ->notify($this->getCheckoutNotification($event, $acceptance));
|
||||
// } else {
|
||||
// Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
|
||||
// ->notify($this->getCheckoutNotification($event, $acceptance));
|
||||
// }
|
||||
// }
|
||||
} catch (ClientException $e) {
|
||||
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
|
@ -113,7 +113,6 @@ class CheckoutableListener
|
|||
$event->checkedOutTo,
|
||||
$event->checkedOutBy,
|
||||
$event->note,
|
||||
null,
|
||||
));
|
||||
|
||||
// Send email notifications
|
||||
|
|
|
@ -32,28 +32,7 @@ class CheckoutAssetNotification extends Notification
|
|||
*/
|
||||
public function __construct(Asset $asset, $checkedOutTo, User $checkedOutBy, $acceptance, $note)
|
||||
{
|
||||
$this->item = $asset;
|
||||
$this->admin = $checkedOutBy;
|
||||
$this->note = $note;
|
||||
$this->target = $checkedOutTo;
|
||||
$this->acceptance = $acceptance;
|
||||
|
||||
$this->settings = Setting::getSettings();
|
||||
|
||||
$this->last_checkout = '';
|
||||
$this->expected_checkin = '';
|
||||
|
||||
if ($this->item->last_checkout) {
|
||||
$this->last_checkout = Helper::getFormattedDateObject($this->item->last_checkout, 'date',
|
||||
false);
|
||||
}
|
||||
|
||||
if ($this->item->expected_checkin) {
|
||||
$this->expected_checkin = Helper::getFormattedDateObject($this->item->expected_checkin, 'date',
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
|
|
|
@ -24,6 +24,8 @@ use App\Http\Controllers\Auth\LoginController;
|
|||
use App\Http\Controllers\Auth\ForgotPasswordController;
|
||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||
use App\Livewire\Importer;
|
||||
use App\Models\Asset;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
|
@ -53,6 +55,26 @@ Route::group(['middleware' => 'auth'], function () {
|
|||
/*
|
||||
* Locations
|
||||
*/
|
||||
Route::get('/test-email', function() {
|
||||
$item = Asset::find(1); // Load some test data
|
||||
$admin = User::find(1);
|
||||
$target = User::find(2);
|
||||
$acceptance = null; // Simulate acceptance data
|
||||
$note = 'Test note';
|
||||
|
||||
$fields = [];
|
||||
if (($item->model) && ($item->model->fieldset)) {
|
||||
$fields = $item->model->fieldset->fields;
|
||||
}
|
||||
|
||||
return new \App\Mail\CheckoutAssetMail(
|
||||
$item,
|
||||
$admin,
|
||||
$target,
|
||||
$acceptance,
|
||||
$note);
|
||||
});
|
||||
|
||||
|
||||
Route::group(['prefix' => 'locations', 'middleware' => ['auth']], function () {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue