Skip to content

A free open source IT asset/license management system

Apply pint to Notifications directory

snipe31043d1f5cb5
diff --git a/app/Notifications/AcceptanceItemAcceptedNotification.php b/app/Notifications/AcceptanceItemAcceptedNotification.php
index c1c30b82be..b169f5dbe6 100644
--- a/app/Notifications/AcceptanceItemAcceptedNotification.php
+++ b/app/Notifications/AcceptanceItemAcceptedNotification.php
@@ -60,23 +60,23 @@ class AcceptanceItemAcceptedNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
$message = (new MailMessage)->markdown('notifications.markdown.asset-acceptance',
[
- 'item_tag' => $this->item_tag,
- 'item_name' => $this->item_name,
- 'item_model' => $this->item_model,
- 'item_serial' => $this->item_serial,
- 'item_status' => $this->item_status,
- 'note' => $this->note,
+ 'item_tag' => $this->item_tag,
+ 'item_name' => $this->item_name,
+ 'item_model' => $this->item_model,
+ 'item_serial' => $this->item_serial,
+ 'item_status' => $this->item_status,
+ 'note' => $this->note,
'accepted_date' => $this->accepted_date,
- 'assigned_to' => $this->assigned_to,
- 'company_name' => $this->company_name,
+ 'assigned_to' => $this->assigned_to,
+ 'company_name' => $this->company_name,
'qty' => $this->qty,
- 'intro_text' => trans('mail.acceptance_accepted_greeting', ['user' => $this->assigned_to, 'item' => $this->item_name]),
+ 'intro_text' => trans('mail.acceptance_accepted_greeting', ['user' => $this->assigned_to, 'item' => $this->item_name]),
])
->subject('✅ '.trans('mail.acceptance_accepted', ['user' => $this->assigned_to, 'item' => $this->item_name]))
->withSymfonyMessage(function (Email $message) {
@@ -87,5 +87,4 @@ class AcceptanceItemAcceptedNotification extends Notification
return $message;
}
-
}
diff --git a/app/Notifications/AcceptanceItemAcceptedToUserNotification.php b/app/Notifications/AcceptanceItemAcceptedToUserNotification.php
index bdfb22c556..29ddf099dc 100644
--- a/app/Notifications/AcceptanceItemAcceptedToUserNotification.php
+++ b/app/Notifications/AcceptanceItemAcceptedToUserNotification.php
@@ -55,27 +55,27 @@ class AcceptanceItemAcceptedToUserNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
$pdf_path = storage_path('private_uploads/eula-pdfs/'.$this->file);
$message = (new MailMessage)->markdown('notifications.markdown.asset-acceptance',
[
- 'item_tag' => $this->item_tag,
- 'item_name' => $this->item_name,
- 'item_model' => $this->item_model,
- 'item_serial' => $this->item_serial,
- 'item_status' => $this->item_status,
- 'note' => $this->note,
+ 'item_tag' => $this->item_tag,
+ 'item_name' => $this->item_name,
+ 'item_model' => $this->item_model,
+ 'item_serial' => $this->item_serial,
+ 'item_status' => $this->item_status,
+ 'note' => $this->note,
'accepted_date' => $this->accepted_date,
- 'assigned_to' => $this->assigned_to,
- 'company_name' => $this->company_name,
+ 'assigned_to' => $this->assigned_to,
+ 'company_name' => $this->company_name,
'qty' => $this->qty,
- 'intro_text' => trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]),
+ 'intro_text' => trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]),
])
->attach($pdf_path)
- ->subject('✅ '. trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]))
+ ->subject('✅ '.trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
@@ -84,7 +84,4 @@ class AcceptanceItemAcceptedToUserNotification extends Notification
return $message;
}
-
-
-
}
diff --git a/app/Notifications/AcceptanceItemDeclinedNotification.php b/app/Notifications/AcceptanceItemDeclinedNotification.php
index 4de5253908..6c585893b9 100644
--- a/app/Notifications/AcceptanceItemDeclinedNotification.php
+++ b/app/Notifications/AcceptanceItemDeclinedNotification.php
@@ -57,25 +57,25 @@ class AcceptanceItemDeclinedNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail($notifiable)
{
$message = (new MailMessage)->markdown('notifications.markdown.asset-acceptance',
[
- 'item_tag' => $this->item_tag,
- 'item_name' => $this->item_name,
- 'item_model' => $this->item_model,
- 'item_serial' => $this->item_serial,
- 'item_status' => $this->item_status,
- 'note' => $this->note,
+ 'item_tag' => $this->item_tag,
+ 'item_name' => $this->item_name,
+ 'item_model' => $this->item_model,
+ 'item_serial' => $this->item_serial,
+ 'item_status' => $this->item_status,
+ 'note' => $this->note,
'declined_date' => $this->declined_date,
- 'assigned_to' => $this->assigned_to,
- 'company_name' => $this->company_name,
- 'qty' => $this->qty,
- 'admin' => $this->admin,
- 'user' => $this->assigned_to,
- 'intro_text' => trans('mail.acceptance_declined_greeting', ['user' => $this->assigned_to]),
+ 'assigned_to' => $this->assigned_to,
+ 'company_name' => $this->company_name,
+ 'qty' => $this->qty,
+ 'admin' => $this->admin,
+ 'user' => $this->assigned_to,
+ 'intro_text' => trans('mail.acceptance_declined_greeting', ['user' => $this->assigned_to]),
])
->subject('⚠️ '.trans('mail.acceptance_declined', ['user' => $this->assigned_to, 'item' => $this->item_name]))
->withSymfonyMessage(function (Email $message) {
@@ -86,5 +86,4 @@ class AcceptanceItemDeclinedNotification extends Notification
return $message;
}
-
}
diff --git a/app/Notifications/AuditNotification.php b/app/Notifications/AuditNotification.php
index af94cefddc..33b35e7ed4 100644
--- a/app/Notifications/AuditNotification.php
+++ b/app/Notifications/AuditNotification.php
@@ -17,29 +17,24 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
-use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class AuditNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
- *
- * @param $params
*/
public function __construct($params)
{
//
$this->settings = Setting::getSettings();
$this->params = $params;
- $item = $params['item'];
- if (!$item || !is_object($item)) {
+ $item = $params['item'];
+ if (! $item || ! is_object($item)) {
throw new \InvalidArgumentException('Notification requires a valid item.');
}
}
@@ -52,7 +47,7 @@ class AuditNotification extends Notification
public function via()
{
$notifyBy = [];
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
Log::debug('use webhook');
$notifyBy[] = SlackWebhookChannel::class;
}
@@ -64,12 +59,14 @@ class AuditNotification extends Notification
Log::debug('using google webhook');
$notifyBy[] = GoogleChatChannel::class;
}
+
return $notifyBy;
}
public function toSlack()
{
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
+
return (new SlackMessage)
->success()
->content(class_basename(get_class($this->params['item'])).' '.trans('general.audited'))
@@ -97,43 +94,46 @@ class AuditNotification extends Notification
$location = $params['location'] ?? '';
$setting = Setting::getSettings();
- //if somehow a notification triggers without an item, bail out.
- if(!$item || !is_object($item)){
+ // if somehow a notification triggers without an item, bail out.
+ if (! $item || ! is_object($item)) {
return null;
}
- if(!Str::contains($setting->webhook_endpoint, 'workflows')) {
+ if (! Str::contains($setting->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($setting->webhook_endpoint)
->type('success')
->title(class_basename($item).' '.trans('general.audited'))
->addStartGroupToSection('activityText')
->fact(trans('mail.asset'), $item)
- ->fact(trans('general.administrator'), $admin_user->present()->viewUrl() . '|' . $admin_user->display_name);
+ ->fact(trans('general.administrator'), $admin_user->present()->viewUrl().'|'.$admin_user->display_name);
}
- $message = class_basename(get_class($params['item'])) . trans('general.audited_by').' '.$admin_user->display_name;
- $details = [
- trans('mail.asset') => htmlspecialchars_decode($item->display_name),
- trans('mail.notes') => $note ?: '',
- trans('general.location') => $location ?: '',
- ];
- return [$message, $details];
+ $message = class_basename(get_class($params['item'])).trans('general.audited_by').' '.$admin_user->display_name;
+ $details = [
+ trans('mail.asset') => htmlspecialchars_decode($item->display_name),
+ trans('mail.notes') => $note ?: '',
+ trans('general.location') => $location ?: '',
+ ];
+
+ return [$message, $details];
}
+
public function toGoogleChat()
{
- $item = $this->params['item'] ?? null;
+ $item = $this->params['item'] ?? null;
$admin_user = $this->params['admin'] ?? null;
- $note = $this->params['note'] ?? '';
- $setting = $this->settings ?? Setting::getSettings();
+ $note = $this->params['note'] ?? '';
+ $setting = $this->settings ?? Setting::getSettings();
- $title = '<strong>' . class_basename($item) . ' ' . trans('general.audited') . '</strong>';
+ $title = '<strong>'.class_basename($item).' '.trans('general.audited').'</strong>';
$subtitle = htmlspecialchars_decode($item->display_name ?? '');
\Log::debug('Google Chat audit payload', [
- 'title' => $title,
+ 'title' => $title,
'subtitle' => $subtitle,
- 'admin' => $admin_user->display_name,
- 'note' => $note,
+ 'admin' => $admin_user->display_name,
+ 'note' => $note,
]);
+
return GoogleChatMessage::create()
->to($setting->webhook_endpoint)
->card(
diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php
index 1716c49e19..37ee8c3510 100644
--- a/app/Notifications/CheckinAccessoryNotification.php
+++ b/app/Notifications/CheckinAccessoryNotification.php
@@ -7,7 +7,6 @@ use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Channels\SlackWebhookChannel;
-use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Str;
@@ -27,7 +26,7 @@ class CheckinAccessoryNotification extends Notification
/**
* Create a new notification instance.
*
- * @param $params
+ * @param $params
*/
public function __construct(Accessory $accessory, $checkedOutTo, User $checkedInby, $note)
{
@@ -56,7 +55,7 @@ class CheckinAccessoryNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
$notifyBy[] = SlackWebhookChannel::class;
}
@@ -89,18 +88,19 @@ class CheckinAccessoryNotification extends Notification
->content(':arrow_down: :keyboard: '.trans('mail.Accessory_Checkin_Notification'))
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
});
}
+
public function toMicrosoftTeams()
{
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -109,7 +109,7 @@ class CheckinAccessoryNotification extends Notification
->addStartGroupToSection('activityText')
->fact(htmlspecialchars_decode($item->display_name), '', 'activityTitle')
->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '')
- ->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->display_name)
+ ->fact(trans('mail.Accessory_Checkin_Notification').' by ', $admin->display_name)
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
->fact(trans('mail.notes'), $note ?: '');
}
@@ -118,12 +118,14 @@ class CheckinAccessoryNotification extends Notification
$details = [
trans('mail.accessory_name') => htmlspecialchars_decode($item->display_name),
trans('mail.checked_into') => $item->location->name ? $item->location->name : '',
- trans('mail.Accessory_Checkin_Notification'). ' by' => $admin->display_name,
- trans('admin/consumables/general.remaining')=> $item->numRemaining(),
+ trans('mail.Accessory_Checkin_Notification').' by' => $admin->display_name,
+ trans('admin/consumables/general.remaining') => $item->numRemaining(),
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+
+ return [$message, $details];
}
+
public function toGoogleChat()
{
$item = $this->item;
@@ -142,7 +144,7 @@ class CheckinAccessoryNotification extends Notification
KeyValue::create(
trans('mail.checked_into').': '.$item->location->name ? $item->location->name : '',
trans('admin/consumables/general.remaining').': '.$item->numRemaining(),
- trans('admin/hardware/form.notes').": ".$note ?: '',
+ trans('admin/hardware/form.notes').': '.$note ?: '',
)
->onClick(route('accessories.show', $item->id))
)
diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.php
index 8238681698..7fd35495a4 100644
--- a/app/Notifications/CheckinAssetNotification.php
+++ b/app/Notifications/CheckinAssetNotification.php
@@ -8,9 +8,9 @@ use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Channels\SlackWebhookChannel;
-use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
+use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use NotificationChannels\GoogleChat\Card;
use NotificationChannels\GoogleChat\GoogleChatChannel;
@@ -19,7 +19,7 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
-use Illuminate\Support\Facades\Log;
+
#[AllowDynamicProperties]
class CheckinAssetNotification extends Notification
{
@@ -28,7 +28,7 @@ class CheckinAssetNotification extends Notification
/**
* Create a new notification instance.
*
- * @param $params
+ * @param $params
*/
public function __construct(Asset $asset, $checkedOutTo, User $checkedInBy, $note)
{
@@ -62,7 +62,7 @@ class CheckinAssetNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
Log::debug('use webhook');
$notifyBy[] = SlackWebhookChannel::class;
}
@@ -92,24 +92,24 @@ class CheckinAssetNotification extends Notification
$fields[trans('general.company')] = $item->company->name;
}
-
return (new SlackMessage)
->content(':arrow_down: :computer: '.trans('mail.Asset_Checkin_Notification', ['tag' => '']))
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
});
}
+
public function toMicrosoftTeams()
{
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -122,7 +122,6 @@ class CheckinAssetNotification extends Notification
->fact(trans('mail.notes'), $note ?: '');
}
-
$message = trans('mail.Asset_Checkin_Notification', ['tag' => '']);
$details = [
trans('mail.asset') => htmlspecialchars_decode($item->display_name),
@@ -132,8 +131,9 @@ class CheckinAssetNotification extends Notification
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+ return [$message, $details];
}
+
public function toGoogleChat()
{
$target = $this->target;
@@ -145,7 +145,7 @@ class CheckinAssetNotification extends Notification
->card(
Card::create()
->header(
- '<strong>'.trans('mail.Asset_Checkin_Notification', ['tag' =>'']).'</strong>' ?: '',
+ '<strong>'.trans('mail.Asset_Checkin_Notification', ['tag' => '']).'</strong>' ?: '',
htmlspecialchars_decode($item->display_name) ?: '',
)
->section(
@@ -153,7 +153,7 @@ class CheckinAssetNotification extends Notification
KeyValue::create(
trans('mail.checked_into') ?: '',
($item->location) ? $item->location->name : '',
- trans('admin/hardware/form.status').": ".$item->assetstatus?->name,
+ trans('admin/hardware/form.status').': '.$item->assetstatus?->name,
)
->onClick(route('hardware.show', $item->id))
)
diff --git a/app/Notifications/CheckinComponentNotification.php b/app/Notifications/CheckinComponentNotification.php
index 5bb0edbfe1..858d35bb63 100644
--- a/app/Notifications/CheckinComponentNotification.php
+++ b/app/Notifications/CheckinComponentNotification.php
@@ -22,15 +22,13 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
class CheckinComponentNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
*
- * @param $params
+ * @param $params
*/
public function __construct(Component $component, $checkedOutTo, User $checkedInBy, $note)
{
@@ -59,7 +57,7 @@ class CheckinComponentNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
$notifyBy[] = SlackWebhookChannel::class;
}
@@ -77,7 +75,7 @@ class CheckinComponentNotification extends Notification
if ($admin) {
$fields = [
- trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
+ trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
];
@@ -100,19 +98,20 @@ class CheckinComponentNotification extends Notification
->content(':arrow_down: :package: '.trans('mail.Component_checkin_notification'))
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
});
}
+
public function toMicrosoftTeams()
{
$target = $this->target;
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -120,7 +119,7 @@ class CheckinComponentNotification extends Notification
->title(trans('mail.Component_checkin_notification'))
->addStartGroupToSection('activityText')
->fact(htmlspecialchars_decode($item->display_name), '', 'header')
- ->fact(trans('mail.Component_checkin_notification')." by ", $admin->display_name ?: 'CLI tool')
+ ->fact(trans('mail.Component_checkin_notification').' by ', $admin->display_name ?: 'CLI tool')
->fact(trans('mail.checkedin_from'), $target->display_name)
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
->fact(trans('mail.notes'), $note ?: '');
@@ -128,14 +127,15 @@ class CheckinComponentNotification extends Notification
$message = trans('mail.Component_checkin_notification');
$details = [
- trans('mail.checkedin_from')=> $target->display_name,
- trans('mail.Component_checkin_notification')." by " => $admin->display_name ?: 'CLI tool',
+ trans('mail.checkedin_from') => $target->display_name,
+ trans('mail.Component_checkin_notification').' by ' => $admin->display_name ?: 'CLI tool',
trans('admin/consumables/general.remaining') => $item->numRemaining(),
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+ return [$message, $details];
}
+
public function toGoogleChat()
{
$target = $this->target;
@@ -154,7 +154,7 @@ class CheckinComponentNotification extends Notification
Section::create(
KeyValue::create(
trans('mail.checkedin_from') ?: '',
- $target->display_name ?: '',
+ $target->display_name ?: '',
trans('admin/consumables/general.remaining').': '.$item->numRemaining(),
)
->onClick(route('components.show', $item->id))
diff --git a/app/Notifications/CheckinLicenseSeatNotification.php b/app/Notifications/CheckinLicenseSeatNotification.php
index 9352d83024..7bafa53ee9 100644
--- a/app/Notifications/CheckinLicenseSeatNotification.php
+++ b/app/Notifications/CheckinLicenseSeatNotification.php
@@ -7,7 +7,6 @@ use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Channels\SlackWebhookChannel;
-use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Str;
@@ -23,15 +22,13 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
class CheckinLicenseSeatNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
*
- * @param $params
+ * @param $params
*/
public function __construct(LicenseSeat $licenseSeat, $checkedOutTo, User $checkedInBy, $note)
{
@@ -60,7 +57,7 @@ class CheckinLicenseSeatNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
$notifyBy[] = SlackWebhookChannel::class;
}
@@ -78,7 +75,7 @@ class CheckinLicenseSeatNotification extends Notification
if ($admin) {
$fields = [
- trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
+ trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
];
@@ -101,19 +98,20 @@ class CheckinLicenseSeatNotification extends Notification
->content(':arrow_down: :floppy_disk: '.trans('mail.License_Checkin_Notification'))
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
});
}
+
public function toMicrosoftTeams()
{
$target = $this->target;
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -121,7 +119,7 @@ class CheckinLicenseSeatNotification extends Notification
->title(trans('mail.License_Checkin_Notification'))
->addStartGroupToSection('activityText')
->fact(htmlspecialchars_decode($item->display_name), '', 'header')
- ->fact(trans('mail.License_Checkin_Notification')." by ", $admin->display_name ?: 'CLI tool')
+ ->fact(trans('mail.License_Checkin_Notification').' by ', $admin->display_name ?: 'CLI tool')
->fact(trans('mail.checkedin_from'), $target->display_name)
->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count())
->fact(trans('mail.notes'), $note ?: '');
@@ -129,15 +127,16 @@ class CheckinLicenseSeatNotification extends Notification
$message = trans('mail.License_Checkin_Notification');
$details = [
- trans('mail.checkedin_from')=> $target->display_name,
+ trans('mail.checkedin_from') => $target->display_name,
trans('mail.license_for') => htmlspecialchars_decode($item->display_name),
- trans('mail.License_Checkin_Notification')." by " => $admin->display_name ?: 'CLI tool',
+ trans('mail.License_Checkin_Notification').' by ' => $admin->display_name ?: 'CLI tool',
trans('admin/consumables/general.remaining') => $item->availCount()->count(),
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+ return [$message, $details];
}
+
public function toGoogleChat()
{
$target = $this->target;
@@ -156,7 +155,7 @@ class CheckinLicenseSeatNotification extends Notification
Section::create(
KeyValue::create(
trans('mail.checkedin_from') ?: '',
- $target->display_name ?: '',
+ $target->display_name ?: '',
trans('admin/consumables/general.remaining').': '.$item->availCount()->count(),
)
->onClick(route('licenses.show', $item->id))
diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.php
index 433d278b25..81f1d6f49b 100644
--- a/app/Notifications/CheckoutAccessoryNotification.php
+++ b/app/Notifications/CheckoutAccessoryNotification.php
@@ -9,6 +9,7 @@ use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
+use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use NotificationChannels\GoogleChat\Card;
use NotificationChannels\GoogleChat\GoogleChatChannel;
@@ -17,7 +18,6 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
-use Illuminate\Support\Facades\Log;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
@@ -57,7 +57,7 @@ class CheckoutAccessoryNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
$notifyBy[] = 'slack';
}
@@ -118,12 +118,13 @@ class CheckoutAccessoryNotification extends Notification
->content(':arrow_up: :keyboard: Accessory Checked Out')
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($this->checkout_qty.' x '.$item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
});
}
+
public function toMicrosoftTeams()
{
$target = $this->target;
@@ -131,7 +132,7 @@ class CheckoutAccessoryNotification extends Notification
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -142,7 +143,7 @@ class CheckoutAccessoryNotification extends Notification
->fact(trans('mail.assigned_to'), $target->display_name)
->fact(trans('general.qty'), $this->checkout_qty)
->fact(trans('mail.checkedout_from'), $item->location->name ? $item->location->name : '')
- ->fact(trans('mail.Accessory_Checkout_Notification') . " by ", $admin->display_name)
+ ->fact(trans('mail.Accessory_Checkout_Notification').' by ', $admin->display_name)
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
->fact(trans('mail.notes'), $note ?: '');
}
@@ -153,12 +154,14 @@ class CheckoutAccessoryNotification extends Notification
trans('mail.accessory_name') => htmlspecialchars_decode($item->display_name),
trans('general.qty') => $this->checkout_qty,
trans('mail.checkedout_from') => $item->location->name ? $item->location->name : '',
- trans('mail.Accessory_Checkout_Notification'). ' by' => $admin->display_name,
- trans('admin/consumables/general.remaining')=> $item->numRemaining(),
+ trans('mail.Accessory_Checkout_Notification').' by' => $admin->display_name,
+ trans('admin/consumables/general.remaining') => $item->numRemaining(),
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+
+ return [$message, $details];
}
+
public function toGoogleChat()
{
$target = $this->target;
@@ -178,7 +181,7 @@ class CheckoutAccessoryNotification extends Notification
KeyValue::create(
trans('mail.assigned_to') ?: '',
$target->present()->name ?: '',
- trans('admin/consumables/general.remaining').": ". $item->numRemaining(),
+ trans('admin/consumables/general.remaining').': '.$item->numRemaining(),
)
->onClick(route('users.show', $target->id))
)
@@ -187,11 +190,10 @@ class CheckoutAccessoryNotification extends Notification
}
-
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
@@ -203,14 +205,14 @@ class CheckoutAccessoryNotification extends Notification
return (new MailMessage)->markdown('notifications.markdown.checkout-accessory',
[
- 'item' => $this->item,
- 'admin' => $this->admin,
- 'note' => $this->note,
- 'target' => $this->target,
- 'eula' => $eula,
- 'req_accept' => $req_accept,
- 'accept_url' => $accept_url,
- 'checkout_qty' => $this->checkout_qty,
+ 'item' => $this->item,
+ 'admin' => $this->admin,
+ 'note' => $this->note,
+ 'target' => $this->target,
+ 'eula' => $eula,
+ 'req_accept' => $req_accept,
+ 'accept_url' => $accept_url,
+ 'checkout_qty' => $this->checkout_qty,
])
->subject(trans('mail.Confirm_accessory_delivery'))
->withSymfonyMessage(function (Email $message) {
diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.php
index 4dd9ea7301..fbd4a931bf 100644
--- a/app/Notifications/CheckoutAssetNotification.php
+++ b/app/Notifications/CheckoutAssetNotification.php
@@ -6,24 +6,19 @@ use App\Helpers\Helper;
use App\Models\Asset;
use App\Models\Setting;
use App\Models\User;
-use Exception;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Channels\SlackWebhookChannel;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
+use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use NotificationChannels\GoogleChat\Card;
-use NotificationChannels\GoogleChat\Enums\Icon;
-use NotificationChannels\GoogleChat\Enums\ImageStyle;
use NotificationChannels\GoogleChat\GoogleChatChannel;
use NotificationChannels\GoogleChat\GoogleChatMessage;
use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
-use Illuminate\Support\Facades\Log;
-use Osama\LaravelTeamsNotification\Logging\TeamsLoggingChannel;
-use Osama\LaravelTeamsNotification\TeamsNotification;
#[AllowDynamicProperties]
class CheckoutAssetNotification extends Notification
@@ -33,7 +28,7 @@ class CheckoutAssetNotification extends Notification
/**
* Create a new notification instance.
*
- * @param $params
+ * @param $params
*/
public function __construct(Asset $asset, $checkedOutTo, User $checkedOutBy, $acceptance, $note)
{
@@ -55,6 +50,7 @@ class CheckoutAssetNotification extends Notification
false);
}
}
+
/**
* Get the notification's delivery channels.
*
@@ -74,8 +70,7 @@ class CheckoutAssetNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class;
}
-
- if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general' ) {
+ if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') {
Log::debug('use webhook');
$notifyBy[] = SlackWebhookChannel::class;
@@ -84,7 +79,7 @@ class CheckoutAssetNotification extends Notification
return $notifyBy;
}
- public function toSlack() :SlackMessage
+ public function toSlack(): SlackMessage
{
$target = $this->target;
$admin = $this->admin;
@@ -114,7 +109,7 @@ class CheckoutAssetNotification extends Notification
->content(':arrow_up: :computer: '.trans('mail.Asset_Checkout_Notification', ['tag' => '']))
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
@@ -128,7 +123,7 @@ class CheckoutAssetNotification extends Notification
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -147,9 +142,11 @@ class CheckoutAssetNotification extends Notification
trans('general.administrator') => $admin->display_name,
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+
+ return [$message, $details];
}
-public function toGoogleChat()
+
+ public function toGoogleChat()
{
$target = $this->target;
$item = $this->item;
diff --git a/app/Notifications/CheckoutComponentNotification.php b/app/Notifications/CheckoutComponentNotification.php
index 7cdf3d39b6..76f0d529de 100644
--- a/app/Notifications/CheckoutComponentNotification.php
+++ b/app/Notifications/CheckoutComponentNotification.php
@@ -3,7 +3,6 @@
namespace App\Notifications;
use App\Models\Component;
-
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
@@ -19,20 +18,17 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
-
#[AllowDynamicProperties]
class CheckoutComponentNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
*
- * @param $params
+ * @param $params
*/
public function __construct(Component $component, $checkedOutTo, User $checkedOutBy, $acceptance, $note)
{
@@ -64,7 +60,7 @@ class CheckoutComponentNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
$notifyBy[] = SlackWebhookChannel::class;
}
@@ -97,12 +93,13 @@ class CheckoutComponentNotification extends Notification
->content(':arrow_up: :package: '.trans('mail.Component_checkout_notification'))
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
});
}
+
public function toMicrosoftTeams()
{
$target = $this->target;
@@ -110,7 +107,7 @@ class CheckoutComponentNotification extends Notification
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -118,7 +115,7 @@ class CheckoutComponentNotification extends Notification
->title(trans('mail.Component_checkout_notification'))
->addStartGroupToSection('activityText')
->fact(htmlspecialchars_decode($item->display_name), '', 'activityTitle')
- ->fact(trans('mail.Component_checkout_notification')." by ", $admin->display_name)
+ ->fact(trans('mail.Component_checkout_notification').' by ', $admin->display_name)
->fact(trans('mail.assigned_to'), $target->display_name)
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
->fact(trans('mail.notes'), $note ?: '');
@@ -133,8 +130,9 @@ class CheckoutComponentNotification extends Notification
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+ return [$message, $details];
}
+
public function toGoogleChat()
{
$target = $this->target;
diff --git a/app/Notifications/CheckoutConsumableNotification.php b/app/Notifications/CheckoutConsumableNotification.php
index c17ecd1375..404a17ab90 100644
--- a/app/Notifications/CheckoutConsumableNotification.php
+++ b/app/Notifications/CheckoutConsumableNotification.php
@@ -7,7 +7,6 @@ use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Channels\SlackWebhookChannel;
-use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Str;
@@ -18,21 +17,18 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
-use Illuminate\Support\Facades\Log;
#[AllowDynamicProperties]
class CheckoutConsumableNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
*
- * @param $params
+ * @param $params
*/
public function __construct(Consumable $consumable, $checkedOutTo, User $checkedOutBy, $acceptance, $note)
{
@@ -64,7 +60,7 @@ class CheckoutConsumableNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
$notifyBy[] = SlackWebhookChannel::class;
}
@@ -97,12 +93,13 @@ class CheckoutConsumableNotification extends Notification
->content(':arrow_up: :paperclip: Consumable Checked Out')
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
});
}
+
public function toMicrosoftTeams()
{
$target = $this->target;
@@ -110,7 +107,7 @@ class CheckoutConsumableNotification extends Notification
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -118,7 +115,7 @@ class CheckoutConsumableNotification extends Notification
->title(trans('mail.Consumable_checkout_notification'))
->addStartGroupToSection('activityText')
->fact(htmlspecialchars_decode($item->display_name), '', 'activityTitle')
- ->fact(trans('mail.Consumable_checkout_notification')." by ", $admin->display_name)
+ ->fact(trans('mail.Consumable_checkout_notification').' by ', $admin->display_name)
->fact(trans('mail.assigned_to'), $target->display_name)
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
->fact(trans('mail.notes'), $note ?: '');
@@ -133,8 +130,9 @@ class CheckoutConsumableNotification extends Notification
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+ return [$message, $details];
}
+
public function toGoogleChat()
{
$target = $this->target;
diff --git a/app/Notifications/CheckoutLicenseSeatNotification.php b/app/Notifications/CheckoutLicenseSeatNotification.php
index 2b83d49d0a..ded1939377 100644
--- a/app/Notifications/CheckoutLicenseSeatNotification.php
+++ b/app/Notifications/CheckoutLicenseSeatNotification.php
@@ -7,7 +7,6 @@ use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Channels\SlackWebhookChannel;
-use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Str;
@@ -23,15 +22,13 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
class CheckoutLicenseSeatNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
*
- * @param $params
+ * @param $params
*/
public function __construct(LicenseSeat $licenseSeat, $checkedOutTo, User $checkedOutBy, $acceptance, $note)
{
@@ -53,16 +50,16 @@ class CheckoutLicenseSeatNotification extends Notification
{
$notifyBy = [];
- if (Setting::getSettings()->webhook_selected == 'google'){
+ if (Setting::getSettings()->webhook_selected == 'google') {
$notifyBy[] = GoogleChatChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'microsoft'){
+ if (Setting::getSettings()->webhook_selected == 'microsoft') {
$notifyBy[] = MicrosoftTeamsChannel::class;
}
- if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
+ if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general') {
$notifyBy[] = SlackWebhookChannel::class;
}
@@ -95,12 +92,13 @@ class CheckoutLicenseSeatNotification extends Notification
->content(':arrow_up: :floppy_disk: License Checked Out')
->from($botname)
->to($channel)
- ->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
+ ->attachment(function ($attachment) use ($item, $note, $fields) {
$attachment->title(htmlspecialchars_decode($item->display_name), $item->present()->viewUrl())
->fields($fields)
->content($note);
});
}
+
public function toMicrosoftTeams()
{
$target = $this->target;
@@ -108,7 +106,7 @@ class CheckoutLicenseSeatNotification extends Notification
$item = $this->item;
$note = $this->note;
- if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
+ if (! Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($this->settings->webhook_endpoint)
->type('success')
@@ -116,7 +114,7 @@ class CheckoutLicenseSeatNotification extends Notification
->title(trans('mail.License_Checkout_Notification'))
->addStartGroupToSection('activityText')
->fact(htmlspecialchars_decode($item->display_name), '', 'activityTitle')
- ->fact(trans('mail.License_Checkout_Notification')." by ", $admin->display_name)
+ ->fact(trans('mail.License_Checkout_Notification').' by ', $admin->display_name)
->fact(trans('mail.assigned_to'), $target->display_name)
->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count())
->fact(trans('mail.notes'), $note ?: '');
@@ -130,8 +128,10 @@ class CheckoutLicenseSeatNotification extends Notification
trans('admin/consumables/general.remaining') => $item->availCount()->count(),
trans('mail.notes') => $note ?: '',
];
- return array($message, $details);
+
+ return [$message, $details];
}
+
public function toGoogleChat()
{
$target = $this->target;
diff --git a/app/Notifications/CurrentInventory.php b/app/Notifications/CurrentInventory.php
index 170f183d94..24a6d96794 100644
--- a/app/Notifications/CurrentInventory.php
+++ b/app/Notifications/CurrentInventory.php
@@ -36,16 +36,16 @@ class CurrentInventory extends Notification
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
$message = (new MailMessage)->markdown('notifications.markdown.user-inventory',
[
- 'assets' => $this->user->assets,
- 'accessories' => $this->user->accessories,
- 'licenses' => $this->user->licenses,
- 'consumables' => $this->user->consumables,
+ 'assets' => $this->user->assets,
+ 'accessories' => $this->user->accessories,
+ 'licenses' => $this->user->licenses,
+ 'consumables' => $this->user->consumables,
])
->subject(trans('mail.inventory_report'))
->withSymfonyMessage(function (Email $message) {
diff --git a/app/Notifications/ExpectedCheckinAdminNotification.php b/app/Notifications/ExpectedCheckinAdminNotification.php
index f525688b0b..ad4089e5a7 100644
--- a/app/Notifications/ExpectedCheckinAdminNotification.php
+++ b/app/Notifications/ExpectedCheckinAdminNotification.php
@@ -11,15 +11,11 @@ use Symfony\Component\Mime\Email;
class ExpectedCheckinAdminNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
- *
- * @param $params
*/
public function __construct($params)
{
@@ -42,13 +38,13 @@ class ExpectedCheckinAdminNotification extends Notification
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
$message = (new MailMessage)->markdown('notifications.markdown.report-expected-checkins',
[
- 'assets' => $this->assets,
+ 'assets' => $this->assets,
])
->subject('⏰'.trans('mail.Expected_Checkin_Report'))
->withSymfonyMessage(function (Email $message) {
diff --git a/app/Notifications/ExpectedCheckinNotification.php b/app/Notifications/ExpectedCheckinNotification.php
index 8efc05d8ab..7b8d446774 100644
--- a/app/Notifications/ExpectedCheckinNotification.php
+++ b/app/Notifications/ExpectedCheckinNotification.php
@@ -13,15 +13,11 @@ use Symfony\Component\Mime\Email;
class ExpectedCheckinNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
- *
- * @param $params
*/
public function __construct($params)
{
@@ -46,11 +42,11 @@ class ExpectedCheckinNotification extends Notification
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
- $today = Carbon::today();
+ $today = Carbon::today();
$expected = Carbon::parse($this->params->expected_checkin)->startOfDay();
$subjectText = $today->greaterThan($expected)
@@ -65,7 +61,7 @@ class ExpectedCheckinNotification extends Notification
'serial' => $this->params->serial,
'asset_tag' => $this->params->asset_tag,
])
- ->subject('⏰'. $subjectText)
+ ->subject('⏰'.$subjectText)
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
diff --git a/app/Notifications/ExpiringAssetsNotification.php b/app/Notifications/ExpiringAssetsNotification.php
index ba861abeab..0236eb17e3 100644
--- a/app/Notifications/ExpiringAssetsNotification.php
+++ b/app/Notifications/ExpiringAssetsNotification.php
@@ -11,15 +11,11 @@ use Symfony\Component\Mime\Email;
class ExpiringAssetsNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
- *
- * @param $params
*/
public function __construct($params, $threshold)
{
@@ -44,14 +40,14 @@ class ExpiringAssetsNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $asset
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
$message = (new MailMessage)->markdown('notifications.markdown.report-expiring-assets',
[
- 'assets' => $this->assets,
- 'threshold' => $this->threshold,
+ 'assets' => $this->assets,
+ 'threshold' => $this->threshold,
])
->subject('⏰'.trans('mail.Expiring_Assets_Report'))
->withSymfonyMessage(function (Email $message) {
diff --git a/app/Notifications/ExpiringLicenseNotification.php b/app/Notifications/ExpiringLicenseNotification.php
index 92a071b5f8..4453ff3b51 100644
--- a/app/Notifications/ExpiringLicenseNotification.php
+++ b/app/Notifications/ExpiringLicenseNotification.php
@@ -11,15 +11,11 @@ use Symfony\Component\Mime\Email;
class ExpiringLicenseNotification extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
- *
- * @param $params
*/
public function __construct($params, $threshold)
{
@@ -45,14 +41,14 @@ class ExpiringLicenseNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $asset
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
$message = (new MailMessage)->markdown('notifications.markdown.report-expiring-licenses',
[
- 'licenses' => $this->licenses,
- 'threshold' => $this->threshold,
+ 'licenses' => $this->licenses,
+ 'threshold' => $this->threshold,
])
->subject('⏰'.trans('mail.Expiring_Licenses_Report'))
->withSymfonyMessage(function (Email $message) {
diff --git a/app/Notifications/FirstAdminNotification.php b/app/Notifications/FirstAdminNotification.php
index 8968384c5b..038571a1be 100644
--- a/app/Notifications/FirstAdminNotification.php
+++ b/app/Notifications/FirstAdminNotification.php
@@ -42,7 +42,7 @@ class FirstAdminNotification extends Notification
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
diff --git a/app/Notifications/InventoryAlert.php b/app/Notifications/InventoryAlert.php
index 17723ad145..5d4baa6bb3 100644
--- a/app/Notifications/InventoryAlert.php
+++ b/app/Notifications/InventoryAlert.php
@@ -12,15 +12,11 @@ use Symfony\Component\Mime\Email;
class InventoryAlert extends Notification
{
use Queueable;
- /**
- * @var
- */
+
private $params;
/**
* Create a new notification instance.
- *
- * @param $params
*/
public function __construct($params, $threshold)
{
@@ -35,22 +31,22 @@ class InventoryAlert extends Notification
*/
public function via()
{
- return (!empty($this->items) && $this->threshold !== null) ? ['mail'] : [];
+ return (! empty($this->items) && $this->threshold !== null) ? ['mail'] : [];
}
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
$message = (new MailMessage)->markdown(
'notifications.markdown.report-low-inventory',
[
- 'items' => $this->items,
- 'threshold' => $this->threshold,
+ 'items' => $this->items,
+ 'threshold' => $this->threshold,
]
)
->subject('⚠️ '.trans('mail.Low_Inventory_Report'))
diff --git a/app/Notifications/MailTest.php b/app/Notifications/MailTest.php
index eaac42ad9f..104329607a 100644
--- a/app/Notifications/MailTest.php
+++ b/app/Notifications/MailTest.php
@@ -35,17 +35,17 @@ class MailTest extends Notification
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
return (new MailMessage)
- ->subject('👋 '.trans('mail.test_email'))
- ->markdown('notifications.Test')
- ->withSymfonyMessage(function (Email $message) {
- $message->getHeaders()->addTextHeader(
- 'X-System-Sender', 'Snipe-IT'
- );
- });
+ ->subject('👋 '.trans('mail.test_email'))
+ ->markdown('notifications.Test')
+ ->withSymfonyMessage(function (Email $message) {
+ $message->getHeaders()->addTextHeader(
+ 'X-System-Sender', 'Snipe-IT'
+ );
+ });
}
}
diff --git a/app/Notifications/RequestAssetCancelation.php b/app/Notifications/RequestAssetCancelation.php
index 56147baa88..f1fba45872 100644
--- a/app/Notifications/RequestAssetCancelation.php
+++ b/app/Notifications/RequestAssetCancelation.php
@@ -13,15 +13,10 @@ use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class RequestAssetCancelation extends Notification
{
- /**
- * @var
- */
private $params;
/**
* Create a new notification instance.
- *
- * @param $params
*/
public function __construct($params)
{
@@ -103,7 +98,7 @@ class RequestAssetCancelation extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
@@ -116,15 +111,15 @@ class RequestAssetCancelation extends Notification
$message = (new MailMessage)->markdown('notifications.markdown.asset-requested',
[
- 'item' => $this->item,
- 'note' => $this->note,
- 'requested_by' => $this->target,
+ 'item' => $this->item,
+ 'note' => $this->note,
+ 'requested_by' => $this->target,
'requested_date' => $this->requested_date,
- 'fields' => $fields,
- 'qty' => $this->item_quantity,
+ 'fields' => $fields,
+ 'qty' => $this->item_quantity,
'last_checkout' => $this->last_checkout,
- 'expected_checkin' => $this->expected_checkin,
- 'intro_text' => trans('mail.a_user_canceled'),
+ 'expected_checkin' => $this->expected_checkin,
+ 'intro_text' => trans('mail.a_user_canceled'),
])
->subject('⚠️ '.trans('general.request_canceled'))
->withSymfonyMessage(function (Email $message) {
diff --git a/app/Notifications/RequestAssetNotification.php b/app/Notifications/RequestAssetNotification.php
index 5b250ff954..0a95ca7413 100644
--- a/app/Notifications/RequestAssetNotification.php
+++ b/app/Notifications/RequestAssetNotification.php
@@ -12,15 +12,10 @@ use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class RequestAssetNotification extends Notification
{
- /**
- * @var
- */
private $params;
/**
* Create a new notification instance.
- *
- * @param $params
*/
public function __construct($params)
{
@@ -97,7 +92,7 @@ class RequestAssetNotification extends Notification
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
@@ -110,15 +105,15 @@ class RequestAssetNotification extends Notification
$message = (new MailMessage)->markdown('notifications.markdown.asset-requested',
[
- 'item' => $this->item,
- 'note' => $this->note,
- 'requested_by' => $this->target,
+ 'item' => $this->item,
+ 'note' => $this->note,
+ 'requested_by' => $this->target,
'requested_date' => $this->requested_date,
- 'fields' => $fields,
+ 'fields' => $fields,
'last_checkout' => $this->last_checkout,
- 'expected_checkin' => $this->expected_checkin,
- 'intro_text' => trans('mail.a_user_requested'),
- 'qty' => $this->item_quantity,
+ 'expected_checkin' => $this->expected_checkin,
+ 'intro_text' => trans('mail.a_user_requested'),
+ 'qty' => $this->item_quantity,
])
->subject('👀 '.trans('mail.Item_Requested'))
->withSymfonyMessage(function (Email $message) {
diff --git a/app/Notifications/SendUpcomingAuditNotification.php b/app/Notifications/SendUpcomingAuditNotification.php
index 1686695254..e9c0d93b1f 100644
--- a/app/Notifications/SendUpcomingAuditNotification.php
+++ b/app/Notifications/SendUpcomingAuditNotification.php
@@ -2,9 +2,7 @@
namespace App\Notifications;
-use App\Models\Setting;
use Illuminate\Bus\Queueable;
-use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
@@ -38,14 +36,14 @@ class SendUpcomingAuditNotification extends Notification
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
- $message = (new MailMessage())->markdown('notifications.markdown.upcoming-audits',
+ $message = (new MailMessage)->markdown('notifications.markdown.upcoming-audits',
[
- 'assets' => $this->assets,
- 'threshold' => $this->threshold,
+ 'assets' => $this->assets,
+ 'threshold' => $this->threshold,
])
->subject('⏰'.trans_choice('mail.upcoming-audits', $this->assets->count(), ['count' => $this->assets->count(), 'threshold' => $this->threshold]))
->withSymfonyMessage(function (Email $message) {
diff --git a/app/Notifications/WelcomeNotification.php b/app/Notifications/WelcomeNotification.php
index bdb099a44d..76c070246e 100644
--- a/app/Notifications/WelcomeNotification.php
+++ b/app/Notifications/WelcomeNotification.php
@@ -2,11 +2,11 @@
namespace App\Notifications;
+use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Password;
-use App\Models\User;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
@@ -15,6 +15,7 @@ class WelcomeNotification extends Notification
use Queueable;
public $expire_date;
+
/**
* Create a new notification instance.
*
@@ -39,12 +40,12 @@ class WelcomeNotification extends Notification
/**
* Get the mail representation of the notification.
*
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @return MailMessage
*/
public function toMail()
{
- return (new MailMessage())
+ return (new MailMessage)
->subject('👋 '.trans('mail.welcome', ['name' => $this->user->first_name.' '.$this->user->last_name]))
->markdown('notifications.Welcome', $this->user->toArray())
->withSymfonyMessage(function (Email $message) {