You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
855 B
32 lines
855 B
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Models\User;
|
|
use App\Models\Business;
|
|
use Illuminate\Support\Arr;
|
|
use App\Events\BusinessUpdate;
|
|
use App\Events\BusinessUserCreate;
|
|
use App\Notifications\DBNotification;
|
|
use App\Notifications\MailNotification;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Support\Facades\Notification;
|
|
|
|
class BusinessUpdateListener
|
|
{
|
|
public function handle(BusinessUpdate $event)
|
|
{
|
|
$payload = $event->message;
|
|
|
|
$wallet = $payload?->data?->diff?->wallet;
|
|
$owners = Business::findOrFail($payload->business)->owners;
|
|
$message = ['body' => 'Test'];
|
|
|
|
if ($wallet < 0) {
|
|
Notification::send($owners, new MailNotification($message));
|
|
Notification::send($owners, new DBNotification($message));
|
|
}
|
|
}
|
|
}
|