mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
fixed asset checkout markdown, and notifiable variable
This commit is contained in:
parent
02bda3cd95
commit
a7754c1a7f
|
@ -16,10 +16,9 @@ use App\Models\CheckoutAcceptance;
|
||||||
use App\Models\Component;
|
use App\Models\Component;
|
||||||
use App\Models\Consumable;
|
use App\Models\Consumable;
|
||||||
use App\Models\LicenseSeat;
|
use App\Models\LicenseSeat;
|
||||||
use App\Models\Recipients\AdminRecipient;
|
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use App\Models\User;
|
|
||||||
use App\Notifications\CheckinAccessoryNotification;
|
use App\Notifications\CheckinAccessoryNotification;
|
||||||
|
use App\Notifications\CheckinAssetNotification;
|
||||||
use App\Notifications\CheckinLicenseSeatNotification;
|
use App\Notifications\CheckinLicenseSeatNotification;
|
||||||
use App\Notifications\CheckoutAccessoryNotification;
|
use App\Notifications\CheckoutAccessoryNotification;
|
||||||
use App\Notifications\CheckoutAssetNotification;
|
use App\Notifications\CheckoutAssetNotification;
|
||||||
|
@ -51,7 +50,7 @@ class CheckoutableListener
|
||||||
* Make a checkout acceptance and attach it in the notification
|
* Make a checkout acceptance and attach it in the notification
|
||||||
*/
|
*/
|
||||||
$acceptance = $this->getCheckoutAcceptance($event);
|
$acceptance = $this->getCheckoutAcceptance($event);
|
||||||
$notifiable = $this->getNotifiable($event);
|
$notifiable = $event->checkedOutTo;
|
||||||
$mailable = $this->getCheckoutMailType($event, $acceptance);
|
$mailable = $this->getCheckoutMailType($event, $acceptance);
|
||||||
// Send email notifications
|
// Send email notifications
|
||||||
try {
|
try {
|
||||||
|
@ -99,7 +98,7 @@ class CheckoutableListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$notifiable = $this->getNotifiable($event);
|
$notifiable = $event->checkedInBy;
|
||||||
$mailable = $this->getCheckinMailType($event);
|
$mailable = $this->getCheckinMailType($event);
|
||||||
|
|
||||||
// Send email notifications
|
// Send email notifications
|
||||||
|
@ -144,34 +143,6 @@ class CheckoutableListener
|
||||||
return $acceptance;
|
return $acceptance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the entities to be notified of the passed event
|
|
||||||
*
|
|
||||||
* @param Event $event
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
private function getNotifiable($event)
|
|
||||||
{
|
|
||||||
$notifiable = collect();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify who checked out the item as long as the model can route notifications
|
|
||||||
*/
|
|
||||||
if (method_exists($event->checkedOutTo, 'routeNotificationFor')) {
|
|
||||||
$notifiable->push($event->checkedOutTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify Admin users if the settings is activated
|
|
||||||
*/
|
|
||||||
if ((Setting::getSettings()) && (Setting::getSettings()->admin_cc_email != '')) {
|
|
||||||
$adminRecipient= new AdminRecipient;
|
|
||||||
$notifiable->push($adminRecipient->getEmail());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new $notifiable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the appropriate notification for the event
|
* Get the appropriate notification for the event
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue