add validation for enabled labels, rename enable (to enabled) in labels table, and update the enabled attribute of corresponding labels to false when cycle saved

This commit is contained in:
Moradi
2025-03-13 12:45:00 +03:30
parent 034000bcef
commit 1d98af0113
6 changed files with 82 additions and 5 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
if (!function_exists('pluckValues')) {
/**
* Extracts the values of a given key from an array of associative arrays.
*
* @param array $array The input array of associative arrays.
* @param string $key The key whose values need to be extracted.
* @return array An array containing the values of the specified key.
*/
function pluckValues(array $array, string $key): array
{
return array_map(function ($item) use ($key) {
return $item[$key] ?? null;
}, $array);
}
}