This commit is contained in:
ct
2025-06-13 09:44:18 +08:00
parent 8d6e86ebb3
commit 2fd4d42aec
54 changed files with 9917 additions and 184 deletions

View File

@@ -1,5 +1,7 @@
<?php
use Vinkla\Hashids\Facades\Hashids;
if (! function_exists('array_to_object_2025')) {
/**
* A magic function that turns all nested array into nested objects. Calling it with no parameter would result in a empty object.
@@ -69,3 +71,23 @@ function array_is_assoc($array): bool
return array_keys($array) !== range(0, count($array) - 1);
}
}
if (! function_exists('hashids_encode')) {
function hashids_encode($id)
{
return Hashids::encode($id);
}
}
if (! function_exists('hashids_decode')) {
function hashids_decode($string)
{
$arr = Hashids::decode($string);
if (count($arr) > 0) {
return $arr[0];
}
return null;
}
}