diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php index 37ee8c3510..16c82e4379 100644 --- a/app/Notifications/CheckinAccessoryNotification.php +++ b/app/Notifications/CheckinAccessoryNotification.php @@ -108,9 +108,9 @@ class CheckinAccessoryNotification extends Notification ->title(trans('Accessory_Checkin_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('admin/consumables/general.remaining'), $item->numRemaining()) + ->fact(trans('mail.checked_into'), $item->location?->name ?: '') + ->fact(trans('mail.Accessory_Checkin_Notification').' by ', (string) ($admin?->display_name ?? '')) + ->fact(trans('admin/consumables/general.remaining'), (string) $item->numRemaining()) ->fact(trans('mail.notes'), $note ?: ''); } diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.php index ce3df70a30..43f1aa8414 100644 --- a/app/Notifications/CheckinAssetNotification.php +++ b/app/Notifications/CheckinAssetNotification.php @@ -116,9 +116,9 @@ class CheckinAssetNotification extends Notification ->title(trans('mail.Asset_Checkin_Notification', ['tag' => ''])) ->addStartGroupToSection('activityText') ->fact(htmlspecialchars_decode($item->display_name), '', 'activityText') - ->fact(trans('mail.checked_into'), ($item->location) ? $item->location->name : '') - ->fact(trans('general.administrator'), $admin->display_name) - ->fact(trans('admin/hardware/form.status'), $item->status?->name) + ->fact(trans('mail.checked_into'), $item->location?->name ?: '') + ->fact(trans('general.administrator'), (string) ($admin?->display_name ?? '')) + ->fact(trans('admin/hardware/form.status'), (string) ($item->status?->name ?? '')) ->fact(trans('mail.notes'), $note ?: ''); } @@ -139,13 +139,14 @@ class CheckinAssetNotification extends Notification $target = $this->target; $item = $this->item; $note = $this->note; -// + + // return GoogleChatMessage::create() ->to($this->settings->webhook_endpoint) ->card( Card::create() ->header( - '' . trans('mail.Asset_Checkin_Notification', ['tag' => '']) . '' ?: '', + ''.trans('mail.Asset_Checkin_Notification', ['tag' => '']).'' ?: '', htmlspecialchars_decode($item->display_name) ?: '', ) ->section( @@ -153,7 +154,7 @@ class CheckinAssetNotification extends Notification KeyValue::create( trans('mail.checked_into') ?: '', ($item->location) ? $item->location?->name : '', - trans('admin/hardware/form.status') . ': ' . $item->status?->name + trans('admin/hardware/form.status').': '.$item->status?->name )->onClick(route('hardware.show', $item->id)) ) ) diff --git a/app/Notifications/CheckinComponentNotification.php b/app/Notifications/CheckinComponentNotification.php index 858d35bb63..309815b66d 100644 --- a/app/Notifications/CheckinComponentNotification.php +++ b/app/Notifications/CheckinComponentNotification.php @@ -119,9 +119,9 @@ 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.checkedin_from'), $target->display_name) - ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) + ->fact(trans('mail.Component_checkin_notification').' by ', $admin?->display_name ?: 'CLI tool') + ->fact(trans('mail.checkedin_from'), (string) ($target?->display_name ?? '')) + ->fact(trans('admin/consumables/general.remaining'), (string) $item->numRemaining()) ->fact(trans('mail.notes'), $note ?: ''); } diff --git a/app/Notifications/CheckinLicenseSeatNotification.php b/app/Notifications/CheckinLicenseSeatNotification.php index 7bafa53ee9..754c79f8ee 100644 --- a/app/Notifications/CheckinLicenseSeatNotification.php +++ b/app/Notifications/CheckinLicenseSeatNotification.php @@ -119,9 +119,9 @@ 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.checkedin_from'), $target->display_name) - ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count()) + ->fact(trans('mail.License_Checkin_Notification').' by ', $admin?->display_name ?: 'CLI tool') + ->fact(trans('mail.checkedin_from'), (string) ($target?->display_name ?? '')) + ->fact(trans('admin/consumables/general.remaining'), (string) $item->availCount()->count()) ->fact(trans('mail.notes'), $note ?: ''); } diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.php index 0ec07b8cbe..f16cab5877 100644 --- a/app/Notifications/CheckoutAccessoryNotification.php +++ b/app/Notifications/CheckoutAccessoryNotification.php @@ -140,11 +140,11 @@ class CheckoutAccessoryNotification extends Notification ->title(trans('mail.Accessory_Checkout_Notification')) ->addStartGroupToSection('activityText') ->fact(htmlspecialchars_decode($item->display_name), '', 'activityTitle') - ->fact(trans('mail.assigned_to'), $target->display_name) + ->fact(trans('mail.assigned_to'), (string) ($target?->display_name ?? '')) ->fact(trans('general.qty'), (string) ($this->checkout_qty ?? 1)) ->fact(trans('mail.checkedout_from'), $item->location?->name ?: '') - ->fact(trans('mail.Accessory_Checkout_Notification').' by ', $admin->display_name) - ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) + ->fact(trans('mail.Accessory_Checkout_Notification').' by ', (string) ($admin?->display_name ?? '')) + ->fact(trans('admin/consumables/general.remaining'), (string) $item->numRemaining()) ->fact(trans('mail.notes'), $note ?: ''); } diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.php index 947a5f89aa..38b346f394 100644 --- a/app/Notifications/CheckoutAssetNotification.php +++ b/app/Notifications/CheckoutAssetNotification.php @@ -129,9 +129,9 @@ class CheckoutAssetNotification extends Notification ->type('success') ->title(trans('mail.Asset_Checkout_Notification', ['tag' => ''])) ->addStartGroupToSection('activityText') - ->fact(trans('mail.assigned_to'), $target->display_name) + ->fact(trans('mail.assigned_to'), (string) ($target?->display_name ?? '')) ->fact(htmlspecialchars_decode($item->display_name), '', 'activityText') - ->fact(trans('general.administrator'), $admin->display_name) + ->fact(trans('general.administrator'), (string) ($admin?->display_name ?? '')) ->fact(trans('mail.notes'), $note ?: ''); } diff --git a/app/Notifications/CheckoutComponentNotification.php b/app/Notifications/CheckoutComponentNotification.php index 76f0d529de..4ad3ab20df 100644 --- a/app/Notifications/CheckoutComponentNotification.php +++ b/app/Notifications/CheckoutComponentNotification.php @@ -115,9 +115,9 @@ 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.assigned_to'), $target->display_name) - ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) + ->fact(trans('mail.Component_checkout_notification').' by ', (string) ($admin?->display_name ?? '')) + ->fact(trans('mail.assigned_to'), (string) ($target?->display_name ?? '')) + ->fact(trans('admin/consumables/general.remaining'), (string) $item->numRemaining()) ->fact(trans('mail.notes'), $note ?: ''); } diff --git a/app/Notifications/CheckoutConsumableNotification.php b/app/Notifications/CheckoutConsumableNotification.php index 404a17ab90..f649b1889a 100644 --- a/app/Notifications/CheckoutConsumableNotification.php +++ b/app/Notifications/CheckoutConsumableNotification.php @@ -115,9 +115,9 @@ 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.assigned_to'), $target->display_name) - ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) + ->fact(trans('mail.Consumable_checkout_notification').' by ', (string) ($admin?->display_name ?? '')) + ->fact(trans('mail.assigned_to'), (string) ($target?->display_name ?? '')) + ->fact(trans('admin/consumables/general.remaining'), (string) $item->numRemaining()) ->fact(trans('mail.notes'), $note ?: ''); } diff --git a/app/Notifications/CheckoutLicenseSeatNotification.php b/app/Notifications/CheckoutLicenseSeatNotification.php index ded1939377..33b29a248d 100644 --- a/app/Notifications/CheckoutLicenseSeatNotification.php +++ b/app/Notifications/CheckoutLicenseSeatNotification.php @@ -114,9 +114,9 @@ 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.assigned_to'), $target->display_name) - ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count()) + ->fact(trans('mail.License_Checkout_Notification').' by ', (string) ($admin?->display_name ?? '')) + ->fact(trans('mail.assigned_to'), (string) ($target?->display_name ?? '')) + ->fact(trans('admin/consumables/general.remaining'), (string) $item->availCount()->count()) ->fact(trans('mail.notes'), $note ?: ''); }