41 lines
989 B
PHP
41 lines
989 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
class AddVirtualMember implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
protected $linkmen, $activity, $order;
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($linkmen, $activity, $order)
|
|
{
|
|
$this->linkmen = $linkmen;
|
|
$this->activity = $activity;
|
|
$this->order = $order;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
$linkmen = $this->linkmen;
|
|
foreach ($linkmen as $linkman) {
|
|
$this->activity->virtualMembers()->firstOrCreate(['mobile'=>$linkman['mobile'],'name'=>$linkman['name'], 'order_id'=>$this->order->id]);
|
|
}
|
|
}
|
|
}
|