52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace App\Jobs;
|
||
|
|
||
|
use App\User;
|
||
|
use Illuminate\Bus\Queueable;
|
||
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||
|
use Illuminate\Queue\InteractsWithQueue;
|
||
|
use Illuminate\Queue\SerializesModels;
|
||
|
use Illuminate\Support\Facades\Log;
|
||
|
|
||
|
class ProcessAccountDelete implements ShouldQueue
|
||
|
{
|
||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||
|
|
||
|
/**
|
||
|
* The user to work with
|
||
|
*
|
||
|
* @var User
|
||
|
*/
|
||
|
protected User $user;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Create a new job instance.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function __construct(User $user)
|
||
|
{
|
||
|
$this->user = $user;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Execute the job.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function handle()
|
||
|
{
|
||
|
// It shouldn't need the suspension service, because if it was dispatched, the account was already locked
|
||
|
|
||
|
Log::alert('[Worker] Processing account deletion request', [
|
||
|
'email' => $this->user->email
|
||
|
]);
|
||
|
|
||
|
$this->user->delete();
|
||
|
}
|
||
|
}
|