Files
UNIT3D-Community-Edition/app/Jobs/ProcessMassPM.php
2020-02-12 15:05:34 -05:00

68 lines
1.6 KiB
PHP

<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
namespace App\Jobs;
use App\Models\PrivateMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ProcessMassPM implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
protected $sender_id;
protected $receiver_id;
protected $subject;
protected $message;
/**
* Create a new job instance.
*
* @param $sender_id
* @param $receiver_id
* @param $subject
* @param $message
*/
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();
}
}