2023-08-15 12:11:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Jobs;
|
|
|
|
|
|
2023-09-15 09:19:36 +00:00
|
|
|
use App\Models\TeamInvitation;
|
2023-08-15 12:11:38 +00:00
|
|
|
use Illuminate\Bus\Queueable;
|
2023-09-14 08:12:44 +00:00
|
|
|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
2023-08-15 12:11:38 +00:00
|
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
2024-11-07 08:16:58 +00:00
|
|
|
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
2023-08-15 12:11:38 +00:00
|
|
|
use Illuminate\Queue\SerializesModels;
|
2024-11-07 08:16:58 +00:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2025-01-07 13:52:08 +00:00
|
|
|
use Throwable;
|
2023-08-15 12:11:38 +00:00
|
|
|
|
2024-06-10 20:43:34 +00:00
|
|
|
class CleanupInstanceStuffsJob implements ShouldBeEncrypted, ShouldBeUnique, ShouldQueue
|
2023-08-15 12:11:38 +00:00
|
|
|
{
|
|
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
|
|
2024-11-07 08:16:58 +00:00
|
|
|
public function middleware(): array
|
|
|
|
|
{
|
|
|
|
|
return [(new WithoutOverlapping('cleanup-instance-stuffs'))->dontRelease()];
|
|
|
|
|
}
|
2023-08-15 12:11:38 +00:00
|
|
|
|
|
|
|
|
public function handle(): void
|
|
|
|
|
{
|
|
|
|
|
try {
|
2024-11-07 08:16:58 +00:00
|
|
|
$this->cleanupInvitationLink();
|
2025-01-07 13:52:08 +00:00
|
|
|
} catch (Throwable $e) {
|
2024-11-07 08:16:58 +00:00
|
|
|
Log::error('CleanupInstanceStuffsJob failed with error: '.$e->getMessage());
|
2023-08-15 12:11:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-11-07 08:16:58 +00:00
|
|
|
private function cleanupInvitationLink()
|
2023-09-15 09:19:36 +00:00
|
|
|
{
|
|
|
|
|
$invitation = TeamInvitation::all();
|
|
|
|
|
foreach ($invitation as $item) {
|
|
|
|
|
$item->isValid();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-15 12:11:38 +00:00
|
|
|
}
|