first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace Common\Auth\Commands;
use Common\Auth\Ban;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
class DeleteExpiredBansCommand extends Command
{
protected $signature = 'bans:deleteExpired';
protected $description = 'Unban users whose ban date has expired.';
public function handle(): int
{
$bans = Ban::query()
->where('expired_at', '<=', Carbon::now()->format('Y-m-d H:i:s'))
->get();
$bans->each(function ($ban) {
$ban->created_by->fill(['banned_at' => null])->save();
$ban->delete();
});
$this->info("Unbanned {$bans->count()} users.");
return Command::SUCCESS;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Common\Auth\Commands;
use Common\Auth\OtpCode;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
class DeleteExpiredOtpCodesCommand extends Command
{
protected $signature = 'otp:deleteExpired';
protected $description = 'Delete one time passwords that have expired.';
public function handle(): int
{
OtpCode::query()
->where('expires_at', '<', Carbon::now())
->delete();
$this->info('Expired OTP codes have been deleted.');
return Command::SUCCESS;
}
}