diff --git a/app/Listeners/BusinessUpdateListener.php b/app/Listeners/BusinessUpdateListener.php index 6378197..9f17d10 100644 --- a/app/Listeners/BusinessUpdateListener.php +++ b/app/Listeners/BusinessUpdateListener.php @@ -2,26 +2,10 @@ namespace App\Listeners; -use App\Models\User; -use App\Models\Business; -use Illuminate\Support\Arr; -<<<<<<< Updated upstream -use App\Channels\FcmChannel; -use App\Events\BusinessUpdate; -use App\Events\BusinessUserCreate; -use App\Notifications\DBNotification; -use App\Notifications\FcmNotification; -use App\Notifications\MailNotification; -use Illuminate\Queue\InteractsWithQueue; -======= use App\Events\BusinessUpdate; -use App\Events\BusinessUserCreate; +use App\Models\Business; use App\Notifications\DBNotification; use App\Notifications\MailNotification; -use Illuminate\Queue\InteractsWithQueue; - ->>>>>>> Stashed changes -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Support\Facades\Notification; class BusinessUpdateListener @@ -29,7 +13,6 @@ class BusinessUpdateListener public function handle(BusinessUpdate $event) { $payload = $event->message; -<<<<<<< Updated upstream $business = Business::findOrFail($payload->business)->load('owners'); $this->checkWalletIsRunningLow($business); @@ -44,7 +27,7 @@ class BusinessUpdateListener $hours = $moving_average_days * 24; $business->load([ - 'cost' => fn ($query) => $query->where('created_at', '>=', now('Asia/Tehran')->subHours($hours)), + 'cost' => fn($query) => $query->where('created_at', '>=', now('Asia/Tehran')->subHours($hours)), ]); // The wallet is running out @@ -78,7 +61,7 @@ class BusinessUpdateListener $recent_payments_number = 10; $negativity_threshold = 20; $business->load([ - 'transactions' => fn ($query) => $query->where('succeeded', '=', true) + 'transactions' => fn($query) => $query->where('succeeded', '=', true) ->orderBy('created_at') ->take($recent_payments_number), ]); @@ -93,16 +76,6 @@ class BusinessUpdateListener $business->update(['suspended_at' => now(),]); Notification::send($business->owners, new MailNotification($message)); Notification::send($business->owners, new DBNotification($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)); ->>>>>>> Stashed changes } } }