mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs\GroupPipeline;
|
|
|
|
use App\Models\Group;
|
|
use App\Models\GroupInvitation;
|
|
use App\Models\Profile;
|
|
use App\Services\NotificationService;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class GroupMemberInvite implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
protected $invite;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(GroupInvitation $invite)
|
|
{
|
|
$this->invite = $invite;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
$invite = $this->invite;
|
|
$actor = Profile::find($invite->from_profile_id);
|
|
$target = Profile::find($invite->to_profile_id);
|
|
|
|
if (! $actor || ! $target) {
|
|
return;
|
|
}
|
|
|
|
NotificationService::createNotification($target->id, $actor->id, 'group:invite', $invite->group_id, Group::class);
|
|
}
|
|
}
|