add test batches

This commit is contained in:
root
2026-06-08 23:45:55 -04:00
parent c792b8be05
commit 8d4d610b82
1480 changed files with 22587 additions and 10762 deletions
+8 -10
View File
@@ -3,34 +3,33 @@
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\Hash;
if (! function_exists('utc_now')) {
if (!function_exists('utc_now')) {
function utc_now(): string
{
return CarbonImmutable::now('UTC')->toDateTimeString();
}
}
if (! function_exists('local_date')) {
if (!function_exists('local_date')) {
function local_date(string $utcDateTime, string $format = 'Y-m-d H:i:s'): string
{
try {
$carbon = CarbonImmutable::parse($utcDateTime)->setTimezone(config('app.timezone'));
return $carbon->format($format);
} catch (Throwable $e) {
} catch (\Throwable $e) {
return CarbonImmutable::parse($utcDateTime)->format($format);
}
}
}
if (! function_exists('user_timezone')) {
if (!function_exists('user_timezone')) {
function user_timezone(): string
{
return (string) (config('School')->attendance['timezone'] ?? config('app.timezone', 'America/New_York'));
}
}
if (! function_exists('pbkdf2_hash')) {
if (!function_exists('pbkdf2_hash')) {
function pbkdf2_hash(string $password, string $algo = 'sha256', int $iterations = 100000, int $length = 64): string
{
$salt = random_bytes(16);
@@ -42,7 +41,7 @@ if (! function_exists('pbkdf2_hash')) {
}
}
if (! function_exists('pbkdf2_verify')) {
if (!function_exists('pbkdf2_verify')) {
function pbkdf2_verify(string $password, string $storedHash): bool
{
$delim = strpos($storedHash, '$') !== false ? '$' : ':';
@@ -63,15 +62,14 @@ if (! function_exists('pbkdf2_verify')) {
}
$calc = hash_pbkdf2($algo, $password, $salt, (int) $iterations, strlen($derived), true);
return hash_equals($derived, $calc);
}
}
if (! function_exists('verify_stored_password')) {
if (!function_exists('verify_stored_password')) {
function verify_stored_password(string $password, ?string $storedHash): bool
{
if (! $storedHash) {
if (!$storedHash) {
return false;
}