mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-05 11:09:33 -06:00
- extracting $sender_id for better visiblity
This commit is contained in:
@@ -16,7 +16,7 @@ BROADCAST_DRIVER=redis
|
||||
CACHE_DRIVER=redis
|
||||
SESSION_DRIVER=redis
|
||||
SESSION_LIFETIME=120
|
||||
QUEUE_CONNECTION=database
|
||||
QUEUE_CONNECTION=redis
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
|
||||
@@ -70,8 +70,8 @@ class MassPMController extends Controller
|
||||
return redirect()->route('massPM')
|
||||
->with($this->toastr->error($v->errors()->toJson(), 'Whoops!', ['options']));
|
||||
} else {
|
||||
$sender_id = 1;
|
||||
foreach ($users as $user) {
|
||||
$sender_id = 1;
|
||||
$this->dispatch(new ProcessMassPM($sender_id, $user->id, $subject, $message));
|
||||
}
|
||||
|
||||
|
||||
49
app/Jobs/ProcessMassPM.php
Normal file
49
app/Jobs/ProcessMassPM.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\PrivateMessage;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class ProcessMassPM implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $sender_id;
|
||||
protected $receiver_id;
|
||||
protected $subject;
|
||||
protected $message;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($sender_id, $receiver_id, $subject, $message)
|
||||
{
|
||||
$this->sender_id = $sender_id;
|
||||
$this->receiver_id = $receiver_id;
|
||||
$this->subject = $subject;
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$pm = new PrivateMessage;
|
||||
$pm->sender_id = $this->sender_id;
|
||||
$pm->receiver_id = $this->receiver_id;
|
||||
$pm->subject = $this->subject;
|
||||
$pm->message = $this->message;
|
||||
$pm->save();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user