cbf6bd5f1f
- fix by removing previous scheduled notifications job before updating the notification configurations
43 lines
845 B
PHP
43 lines
845 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Setting;
|
|
use Carbon\Carbon;
|
|
|
|
class WhatsappUnsoldCommodityScanner extends Job
|
|
{
|
|
public $status;
|
|
public $start_time;
|
|
public $message;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
$settings = Setting::on('mysql7')->where('group', 'unsold_commodity_notifications')->get();
|
|
$status = $settings->where('key', 'status')->first()->value;
|
|
$start_time = $settings->where('key', 'start_time')->first()->value;
|
|
|
|
|
|
if ($status === '0') {
|
|
return false;
|
|
}
|
|
|
|
dispatch((new WhatsappUnsoldCommodityNotification($this->message))->delay(Carbon::parse($start_time)));
|
|
|
|
}
|
|
}
|