Merge pull request #18131 from Godmartinz/fix-inventory-alert-notification-misfire
Adds a null check for items and threshold in inventory alert notification
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use AllowDynamicProperties;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class InventoryAlert extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -32,9 +34,8 @@ class InventoryAlert extends Notification
|
||||
*/
|
||||
public function via()
|
||||
{
|
||||
$notifyBy = ['mail'];
|
||||
return (!empty($this->items) && $this->threshold !== null) ? ['mail'] : [];
|
||||
|
||||
return $notifyBy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user