Clean up extra code in notifications files.

This commit is contained in:
Daniel Meltzer 2020-05-23 14:56:56 -04:00
parent f0546bf689
commit 1e5d40f32e
No known key found for this signature in database
GPG key ID: 91C5C7B09A5B1CA0
21 changed files with 60 additions and 373 deletions

View file

@ -29,10 +29,9 @@ class AuditNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint) { if (Setting::getSettings()->slack_endpoint) {
@ -42,13 +41,13 @@ class AuditNotification extends Notification
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable) public function toSlack()
{ {
return (new SlackMessage) return (new SlackMessage)
->success() ->success()
->content(class_basename(get_class($this->params['item'])) . " Audited") ->content(class_basename(get_class($this->params['item'])) . " Audited")
->attachment(function ($attachment) use ($notifiable) { ->attachment(function ($attachment) {
$item = $this->params['item']; $item = $this->params['item'];
$admin_user = $this->params['admin']; $admin_user = $this->params['admin'];
$fields = [ $fields = [
@ -61,27 +60,4 @@ class AuditNotification extends Notification
->fields($fields); ->fields($fields);
}); });
} }
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -31,7 +31,6 @@ class CheckinAccessoryNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via() public function via()
@ -65,14 +64,11 @@ class CheckinAccessoryNotification extends Notification
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot' ; $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot' ;
$fields = [ $fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>', 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>', 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
]; ];
return (new SlackMessage) return (new SlackMessage)
->content(':arrow_down: :keyboard: Accessory Checked In') ->content(':arrow_down: :keyboard: Accessory Checked In')
->from($botname) ->from($botname)
@ -88,10 +84,8 @@ class CheckinAccessoryNotification extends Notification
* @param mixed $notifiable * @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
return (new MailMessage)->markdown('notifications.markdown.checkin-accessory', return (new MailMessage)->markdown('notifications.markdown.checkin-accessory',
[ [
'item' => $this->item, 'item' => $this->item,
@ -102,17 +96,4 @@ class CheckinAccessoryNotification extends Notification
->subject('Accessory checked in'); ->subject('Accessory checked in');
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -39,7 +39,6 @@ class CheckinAssetNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via() public function via()
@ -53,7 +52,7 @@ class CheckinAssetNotification extends Notification
} }
/** /**
* Only send checkin notifications to users if the category * Only send checkin notifications to users if the category
* has the corresponding checkbox checked. * has the corresponding checkbox checked.
*/ */
if ($this->item->checkin_email() && $this->target instanceof User && $this->target->email != '') if ($this->item->checkin_email() && $this->target instanceof User && $this->target->email != '')
@ -78,7 +77,7 @@ class CheckinAssetNotification extends Notification
trans('general.status') => $item->assetstatus->name, trans('general.status') => $item->assetstatus->name,
trans('general.location') => ($item->location) ? $item->location->name : '', trans('general.location') => ($item->location) ? $item->location->name : '',
]; ];
return (new SlackMessage) return (new SlackMessage)
->content(':arrow_down: :computer: Asset Checked In') ->content(':arrow_down: :computer: Asset Checked In')
->from($botname) ->from($botname)
@ -94,13 +93,10 @@ class CheckinAssetNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail() public function toMail()
{ {
$fields = []; $fields = [];
// Check if the item has custom fields associated with it // Check if the item has custom fields associated with it

View file

@ -35,10 +35,9 @@ class CheckinLicenseSeatNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy = []; $notifyBy = [];
@ -47,7 +46,7 @@ class CheckinLicenseSeatNotification extends Notification
} }
/** /**
* Only send checkin notifications to users if the category * Only send checkin notifications to users if the category
* has the corresponding checkbox checked. * has the corresponding checkbox checked.
*/ */
if ($this->item->checkin_email() && $this->target instanceof User && $this->target->email != '') if ($this->item->checkin_email() && $this->target instanceof User && $this->target->email != '')
@ -58,7 +57,7 @@ class CheckinLicenseSeatNotification extends Notification
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable) public function toSlack()
{ {
$target = $this->target; $target = $this->target;
@ -90,7 +89,7 @@ class CheckinLicenseSeatNotification extends Notification
* @param mixed $notifiable * @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
return (new MailMessage)->markdown('notifications.markdown.checkin-license', return (new MailMessage)->markdown('notifications.markdown.checkin-license',
[ [
@ -103,16 +102,4 @@ class CheckinLicenseSeatNotification extends Notification
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -25,7 +25,7 @@ class CheckoutAccessoryNotification extends Notification
$this->note = $note; $this->note = $note;
$this->target = $checkedOutTo; $this->target = $checkedOutTo;
$this->acceptance = $acceptance; $this->acceptance = $acceptance;
$this->settings = Setting::getSettings(); $this->settings = Setting::getSettings();
} }
@ -33,10 +33,9 @@ class CheckoutAccessoryNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy = []; $notifyBy = [];
@ -52,7 +51,7 @@ class CheckoutAccessoryNotification extends Notification
if ($this->target instanceof User && $this->target->email != '') { if ($this->target instanceof User && $this->target->email != '') {
/** /**
* Send an email if the asset requires acceptance, * Send an email if the asset requires acceptance,
* so the user can accept or decline the asset * so the user can accept or decline the asset
*/ */
if ($this->item->requireAcceptance()) { if ($this->item->requireAcceptance()) {
@ -71,17 +70,15 @@ class CheckoutAccessoryNotification extends Notification
*/ */
if ($this->item->checkin_email()) { if ($this->item->checkin_email()) {
$notifyBy[1] = 'mail'; $notifyBy[1] = 'mail';
} }
} }
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable) public function toSlack()
{ {
$target = $this->target; $target = $this->target;
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
@ -93,8 +90,6 @@ class CheckoutAccessoryNotification extends Notification
'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>', 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
]; ];
return (new SlackMessage) return (new SlackMessage)
->content(':arrow_up: :keyboard: Accessory Checked Out') ->content(':arrow_up: :keyboard: Accessory Checked Out')
->from($botname) ->from($botname)
@ -107,12 +102,10 @@ class CheckoutAccessoryNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
\Log::debug($this->item->getImageUrl()); \Log::debug($this->item->getImageUrl());
$eula = $this->item->getEula(); $eula = $this->item->getEula();
$req_accept = $this->item->requireAcceptance(); $req_accept = $this->item->requireAcceptance();
@ -132,17 +125,4 @@ class CheckoutAccessoryNotification extends Notification
->subject(trans('mail.Confirm_accessory_delivery')); ->subject(trans('mail.Confirm_accessory_delivery'));
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -49,7 +49,6 @@ class CheckoutAssetNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via() public function via()
@ -68,7 +67,7 @@ class CheckoutAssetNotification extends Notification
if ($this->target instanceof User && $this->target->email != '') { if ($this->target instanceof User && $this->target->email != '') {
/** /**
* Send an email if the asset requires acceptance, * Send an email if the asset requires acceptance,
* so the user can accept or decline the asset * so the user can accept or decline the asset
*/ */
if ($this->item->requireAcceptance()) { if ($this->item->requireAcceptance()) {
@ -80,14 +79,14 @@ class CheckoutAssetNotification extends Notification
*/ */
if ($this->item->getEula()) { if ($this->item->getEula()) {
$notifyBy[1] = 'mail'; $notifyBy[1] = 'mail';
} }
/** /**
* Send an email if an email should be sent at checkin/checkout * Send an email if an email should be sent at checkin/checkout
*/ */
if ($this->item->checkin_email()) { if ($this->item->checkin_email()) {
$notifyBy[1] = 'mail'; $notifyBy[1] = 'mail';
} }
} }
@ -160,7 +159,6 @@ class CheckoutAssetNotification extends Notification
return $message; return $message;
} }
} }

View file

@ -39,10 +39,9 @@ class CheckoutConsumableNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy = []; $notifyBy = [];
@ -56,7 +55,7 @@ class CheckoutConsumableNotification extends Notification
if ($this->target instanceof User && $this->target->email != '') { if ($this->target instanceof User && $this->target->email != '') {
/** /**
* Send an email if the asset requires acceptance, * Send an email if the asset requires acceptance,
* so the user can accept or decline the asset * so the user can accept or decline the asset
*/ */
if ($this->item->requireAcceptance()) { if ($this->item->requireAcceptance()) {
@ -68,7 +67,7 @@ class CheckoutConsumableNotification extends Notification
*/ */
if ($this->item->getEula()) { if ($this->item->getEula()) {
$notifyBy[1] = 'mail'; $notifyBy[1] = 'mail';
} }
/** /**
* Send an email if an email should be sent at checkin/checkout * Send an email if an email should be sent at checkin/checkout
@ -77,14 +76,14 @@ class CheckoutConsumableNotification extends Notification
if ((method_exists($this->item, 'checkin_email')) && ($this->item->checkin_email())) { if ((method_exists($this->item, 'checkin_email')) && ($this->item->checkin_email())) {
$notifyBy[1] = 'mail'; $notifyBy[1] = 'mail';
} }
} }
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable) public function toSlack()
{ {
$target = $this->target; $target = $this->target;
$admin = $this->admin; $admin = $this->admin;
@ -109,10 +108,9 @@ class CheckoutConsumableNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
\Log::debug($this->item->getImageUrl()); \Log::debug($this->item->getImageUrl());
@ -135,16 +133,4 @@ class CheckoutConsumableNotification extends Notification
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -37,7 +37,6 @@ class CheckoutLicenseSeatNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via() public function via()
@ -54,7 +53,7 @@ class CheckoutLicenseSeatNotification extends Notification
if ($this->target instanceof User && $this->target->email != '') { if ($this->target instanceof User && $this->target->email != '') {
/** /**
* Send an email if the asset requires acceptance, * Send an email if the asset requires acceptance,
* so the user can accept or decline the asset * so the user can accept or decline the asset
*/ */
if ($this->item->requireAcceptance()) { if ($this->item->requireAcceptance()) {
@ -66,23 +65,22 @@ class CheckoutLicenseSeatNotification extends Notification
*/ */
if ($this->item->getEula()) { if ($this->item->getEula()) {
$notifyBy[1] = 'mail'; $notifyBy[1] = 'mail';
} }
/** /**
* Send an email if an email should be sent at checkin/checkout * Send an email if an email should be sent at checkin/checkout
*/ */
if ($this->item->checkin_email()) { if ($this->item->checkin_email()) {
$notifyBy[1] = 'mail'; $notifyBy[1] = 'mail';
} }
} }
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable) public function toSlack()
{ {
$target = $this->target; $target = $this->target;
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
@ -106,10 +104,9 @@ class CheckoutLicenseSeatNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
$eula = method_exists($this->item, 'getEula') ? $this->item->getEula() : ''; $eula = method_exists($this->item, 'getEula') ? $this->item->getEula() : '';
@ -131,16 +128,4 @@ class CheckoutLicenseSeatNotification extends Notification
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -26,7 +26,7 @@ class CurrentInventory extends Notification
* @param mixed $notifiable * @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
return ['mail']; return ['mail'];
} }
@ -34,10 +34,9 @@ class CurrentInventory extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
$message = (new MailMessage)->markdown('notifications.markdown.user-inventory', $message = (new MailMessage)->markdown('notifications.markdown.user-inventory',
[ [
@ -49,17 +48,4 @@ class CurrentInventory extends Notification
return $message; return $message;
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -27,28 +27,21 @@ class ExpectedCheckinAdminNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy = []; $notifyBy = [];
$notifyBy[]='mail'; $notifyBy[]='mail';
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable)
{
}
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $asset
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($params) public function toMail()
{ {
$message = (new MailMessage)->markdown('notifications.markdown.report-expected-checkins', $message = (new MailMessage)->markdown('notifications.markdown.report-expected-checkins',
@ -62,16 +55,4 @@ class ExpectedCheckinAdminNotification extends Notification
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -28,10 +28,9 @@ class ExpectedCheckinNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy = []; $notifyBy = [];
$item = $this->params['item']; $item = $this->params['item'];
@ -40,18 +39,12 @@ class ExpectedCheckinNotification extends Notification
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable)
{
}
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $asset
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($params) public function toMail()
{ {
$formatted_due = Carbon::parse($this->params->expected_checkin)->format('D, M j, Y'); $formatted_due = Carbon::parse($this->params->expected_checkin)->format('D, M j, Y');
return (new MailMessage) return (new MailMessage)
@ -63,20 +56,6 @@ class ExpectedCheckinNotification extends Notification
->line('Serial: '.$this->params->serial) ->line('Serial: '.$this->params->serial)
->line('Asset Tag: '.$this->params->asset_tag) ->line('Asset Tag: '.$this->params->asset_tag)
->action('View Your Assets', route('view-assets')); ->action('View Your Assets', route('view-assets'));
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -28,28 +28,22 @@ class ExpiringAssetsNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy = []; $notifyBy = [];
$notifyBy[]='mail'; $notifyBy[]='mail';
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable)
{
}
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $asset * @param mixed $asset
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($params) public function toMail()
{ {
$message = (new MailMessage)->markdown('notifications.markdown.report-expiring-assets', $message = (new MailMessage)->markdown('notifications.markdown.report-expiring-assets',
@ -64,16 +58,4 @@ class ExpiringAssetsNotification extends Notification
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -31,25 +31,20 @@ class ExpiringLicenseNotification extends Notification
* @param mixed $notifiable * @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy = []; $notifyBy = [];
$notifyBy[]='mail'; $notifyBy[]='mail';
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable)
{
}
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $asset * @param mixed $asset
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($params) public function toMail()
{ {
$message = (new MailMessage)->markdown('notifications.markdown.report-expiring-licenses', $message = (new MailMessage)->markdown('notifications.markdown.report-expiring-licenses',
@ -64,16 +59,4 @@ class ExpiringLicenseNotification extends Notification
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -30,10 +30,9 @@ class FirstAdminNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
return ['mail']; return ['mail'];
} }
@ -41,26 +40,13 @@ class FirstAdminNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
return (new MailMessage) return (new MailMessage)
->subject(trans('mail.welcome', ['name' => $this->_data['first_name'] . ' ' . $this->_data['last_name'] ])) ->subject(trans('mail.welcome', ['name' => $this->_data['first_name'] . ' ' . $this->_data['last_name'] ]))
->markdown('notifications.FirstAdmin', $this->_data); ->markdown('notifications.FirstAdmin', $this->_data);
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -28,27 +28,21 @@ class InventoryAlert extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
$notifyBy[] = 'mail'; $notifyBy[] = 'mail';
return $notifyBy; return $notifyBy;
} }
public function toSlack($notifiable)
{
}
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $asset
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($params) public function toMail()
{ {
$message = (new MailMessage)->markdown( $message = (new MailMessage)->markdown(
'notifications.markdown.report-low-inventory', 'notifications.markdown.report-low-inventory',
@ -61,17 +55,4 @@ class InventoryAlert extends Notification
return $message; return $message;
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -24,10 +24,9 @@ class MailTest extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
return ['mail']; return ['mail'];
} }
@ -35,26 +34,12 @@ class MailTest extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
return (new MailMessage) return (new MailMessage)
->subject(trans('mail.test_email')) ->subject(trans('mail.test_email'))
->markdown('notifications.Test'); ->markdown('notifications.Test');
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -2,6 +2,7 @@
namespace App\Notifications; namespace App\Notifications;
use App\Helpers\Helper;
use App\Models\Setting; use App\Models\Setting;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Messages\SlackMessage;
@ -27,7 +28,7 @@ class RequestAssetCancelation extends Notification
$this->last_checkout = ''; $this->last_checkout = '';
$this->item_quantity = $params['item_quantity']; $this->item_quantity = $params['item_quantity'];
$this->expected_checkin = ''; $this->expected_checkin = '';
$this->requested_date = \App\Helpers\Helper::getFormattedDateObject($params['requested_date'], 'datetime', $this->requested_date = Helper::getFormattedDateObject($params['requested_date'], 'datetime',
false); false);
$this->settings = Setting::getSettings(); $this->settings = Setting::getSettings();
@ -36,16 +37,14 @@ class RequestAssetCancelation extends Notification
} }
if ($this->item->last_checkout) { if ($this->item->last_checkout) {
$this->last_checkout = \App\Helpers\Helper::getFormattedDateObject($this->item->last_checkout, 'date', $this->last_checkout = Helper::getFormattedDateObject($this->item->last_checkout, 'date',
false); false);
} }
if ($this->item->expected_checkin) { if ($this->item->expected_checkin) {
$this->expected_checkin = \App\Helpers\Helper::getFormattedDateObject($this->item->expected_checkin, 'date', $this->expected_checkin = Helper::getFormattedDateObject($this->item->expected_checkin, 'date',
false); false);
} }
} }
/** /**
@ -72,8 +71,6 @@ class RequestAssetCancelation extends Notification
public function toSlack() public function toSlack()
{ {
$target = $this->target; $target = $this->target;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
@ -130,8 +127,6 @@ class RequestAssetCancelation extends Notification
return $message; return $message;
} }
} }

View file

@ -2,6 +2,7 @@
namespace App\Notifications; namespace App\Notifications;
use App\Helpers\Helper;
use App\Models\Setting; use App\Models\Setting;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Messages\SlackMessage;
@ -28,7 +29,7 @@ class RequestAssetNotification extends Notification
$this->note = ''; $this->note = '';
$this->last_checkout = ''; $this->last_checkout = '';
$this->expected_checkin = ''; $this->expected_checkin = '';
$this->requested_date = \App\Helpers\Helper::getFormattedDateObject($params['requested_date'], 'datetime', $this->requested_date = Helper::getFormattedDateObject($params['requested_date'], 'datetime',
false); false);
$this->settings = Setting::getSettings(); $this->settings = Setting::getSettings();
@ -37,12 +38,12 @@ class RequestAssetNotification extends Notification
} }
if ($this->item->last_checkout) { if ($this->item->last_checkout) {
$this->last_checkout = \App\Helpers\Helper::getFormattedDateObject($this->item->last_checkout, 'date', $this->last_checkout = Helper::getFormattedDateObject($this->item->last_checkout, 'date',
false); false);
} }
if ($this->item->expected_checkin) { if ($this->item->expected_checkin) {
$this->expected_checkin = \App\Helpers\Helper::getFormattedDateObject($this->item->expected_checkin, 'date', $this->expected_checkin = Helper::getFormattedDateObject($this->item->expected_checkin, 'date',
false); false);
} }
@ -73,8 +74,6 @@ class RequestAssetNotification extends Notification
public function toSlack() public function toSlack()
{ {
$target = $this->target; $target = $this->target;
$qty = $this->item_quantity; $qty = $this->item_quantity;
$item = $this->item; $item = $this->item;
@ -98,7 +97,6 @@ class RequestAssetNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail() public function toMail()
@ -127,8 +125,6 @@ class RequestAssetNotification extends Notification
return $message; return $message;
} }
} }

View file

@ -26,10 +26,9 @@ class SendUpcomingAuditNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
return $notifyBy = ['mail']; return $notifyBy = ['mail'];
} }
@ -37,10 +36,9 @@ class SendUpcomingAuditNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
$message = (new MailMessage)->markdown('notifications.markdown.upcoming-audits', $message = (new MailMessage)->markdown('notifications.markdown.upcoming-audits',
[ [
@ -51,17 +49,4 @@ class SendUpcomingAuditNotification extends Notification
return $message; return $message;
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -32,26 +32,13 @@ class SlackTest extends Notification
return ['slack']; return ['slack'];
} }
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return [
//
];
}
/** /**
* Get the Slack representation of the notification. * Get the Slack representation of the notification.
* *
* @param mixed $notifiable * @param mixed $notifiable
* @return SlackMessage * @return SlackMessage
*/ */
public function toSlack($notifiable) public function toSlack()
{ {
$settings = Setting::getSettings(); $settings = Setting::getSettings();
return (new SlackMessage) return (new SlackMessage)
@ -61,17 +48,4 @@ class SlackTest extends Notification
->content('Oh hai! Looks like your Slack integration with Snipe-IT is working!'); ->content('Oh hai! Looks like your Slack integration with Snipe-IT is working!');
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View file

@ -30,10 +30,9 @@ class WelcomeNotification extends Notification
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
* *
* @param mixed $notifiable
* @return array * @return array
*/ */
public function via($notifiable) public function via()
{ {
return ['mail']; return ['mail'];
} }
@ -41,26 +40,12 @@ class WelcomeNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
* *
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage * @return \Illuminate\Notifications\Messages\MailMessage
*/ */
public function toMail($notifiable) public function toMail()
{ {
return (new MailMessage) return (new MailMessage)
->subject(trans('mail.welcome', ['name' => $this->_data['first_name'] . ' ' . $this->_data['last_name'] ])) ->subject(trans('mail.welcome', ['name' => $this->_data['first_name'] . ' ' . $this->_data['last_name'] ]))
->markdown('notifications.Welcome', $this->_data); ->markdown('notifications.Welcome', $this->_data);
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }