feat: finish removing console kernel, add expiring invite notification
Signed-off-by: Miguel Nogueira <me@nogueira.codes>
This commit is contained in:
34
app/Jobs/InviteLifecycleCleanup.php
Normal file
34
app/Jobs/InviteLifecycleCleanup.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Invitation;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Queue\Queueable;
|
||||
|
||||
// General Housekeeping Job: Drop Approved and Completed Invites
|
||||
class InviteLifecycleCleanup implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Invitation::whereIn('status', ['approved', 'completed'])
|
||||
->chunkById(100, function ($invites) {
|
||||
foreach ($invites as $invite) {
|
||||
$invite->delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user