Merge pull request #3509 from coollabsio/delete-unused-ssh-keys

Feat: Delete unused ssh keys button
This commit is contained in:
Andras Bacsai
2024-09-20 13:00:54 +02:00
committed by GitHub
5 changed files with 49 additions and 35 deletions

View File

@@ -1,27 +0,0 @@
<?php
namespace App\Jobs;
use App\Models\PrivateKey;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Carbon\Carbon;
class CleanupSshKeysJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
$oneWeekAgo = Carbon::now()->subWeek();
PrivateKey::where('created_at', '<', $oneWeekAgo)
->get()
->each(function ($privateKey) {
$privateKey->safeDelete();
});
}
}