recreate project

This commit is contained in:
root
2026-02-10 22:11:06 -05:00
commit 663c0cdbda
10149 changed files with 1379710 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Events;
class DeleteUnverifiedUser
{
public $userId;
public function __construct($userId)
{
$this->userId = $userId;
}
public static function deleteAfterTimeout($userId)
{
$model = new self();
// Define the timeout period
$timeoutPeriod = 24 * 60 * 60; // 1 day in seconds
// Retrieve the user's record
$user = $model->find($userId);
if ($user) {
// Get the most recent timestamp to compare with the current time
$lastActivityTime = strtotime($user['updated_at'] ?? $user['created_at']);
// Calculate the time difference
$timeSinceLastActivity = time() - $lastActivityTime;
// Check if the time difference exceeds the timeout period
if ($timeSinceLastActivity > $timeoutPeriod) {
// Delete the user record
return $model->delete($userId);
} else {
// Timeout period has not yet passed
return false; // Or you can return a message indicating no action taken
}
}
// Return false if the user is not found
return false;
}
}