Skip to content

Commit

Permalink
fix in job di notifica chiusura ordini
Browse files Browse the repository at this point in the history
  • Loading branch information
madbob committed May 7, 2024
1 parent ed847d3 commit 5ecd74d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion code/app/Console/Commands/RemindOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function handle()

foreach($notifications as $gas_id => $orders) {
Log::info('Invio promemoria per ordini ' . join(', ', $orders));
NotifyRemindOrder::dispatch($gas_id, $orders);
NotifyRemindOrder::dispatch($orders);
}

$gas = Gas::all();
Expand Down
13 changes: 1 addition & 12 deletions code/app/Jobs/NotifyRemindOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,25 @@
use Illuminate\Queue\SerializesModels;

use App\Notifications\RemindOrderNotification;
use App\Gas;
use App\Order;

class NotifyRemindOrder implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

public $gas_id;
public $orders_id;

public function __construct($gas_id, $orders_id)
public function __construct($orders_id)
{
$this->gas_id = $gas_id;
$this->orders_id = $orders_id;
}

public function handle()
{
$gas = Gas::find($this->gas_id);
if ($gas->hasFeature('send_order_reminder') == false) {
return;
}

$aggregate_users = [];
$hub = app()->make('GlobalScopeHub');

foreach($this->orders_id as $order_id) {
$order = Order::find($order_id);

$hub->setGas($gas->id);
$users = $order->notifiableUsers($gas);

foreach($users as $user) {
Expand Down

0 comments on commit 5ecd74d

Please sign in to comment.