Files
Discount-Bandit/app/Jobs/GroupNotifyJob.php
T
YNWA Fawzy 8a290a0d09 - Added Argos UK to the list of stores
- Added groups, where you can set bunch of items with identified unique keys to get the lowest price on group of products. ( think of it like building your own PC, you add multiple CPUs, and GPUs and the program will notify you when the combination reaches a desired price)
- Added 2FA Support to the system  (Optional)
- Make Sidebar collapsable
- Fix name is too short which results to not be saved
- Fix a bug where product can be duplicated from amazon stores
2024-01-16 15:53:45 +04:00

45 lines
1.1 KiB
PHP

<?php
namespace App\Jobs;
use App\Classes\GroupHelper;
use App\Models\Group;
use App\Models\User;
use App\Notifications\GroupDiscount;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class GroupNotifyJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct(public Group $group , public $current_price){}
/**
* Execute the job.
*/
public function handle(): void
{
try {
$user=User::first();
$user->notify(
new GroupDiscount(
group: $this->group->name,
current_price: $this->current_price,
currency: $this->group->currency->code
));
}
catch (\Exception $e)
{
\Log::error("Sending Group Notification");
}
}
}