mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
42 lines
975 B
PHP
42 lines
975 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class PurgeDeletedAccounts implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* Find users that were soft-deleted 6 months ago and permanently delete them.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
// Find users that were soft-deleted 6 months ago
|
|
User::onlyTrashed()
|
|
->where('deleted_at', '<', now()->subMonths(6))
|
|
->get()
|
|
->each(function ($user) {
|
|
$user->forceDelete(); // Permanently delete the user
|
|
});
|
|
}
|
|
}
|