public static function arrayChangeKeys($data, $keyName = 'id')
    {
        $temp = [];
        if (is_array($data)) {
            foreach ($data as $key => $row) {
                if (isset($row[$keyName])) {
                    $temp[$row[$keyName]] = $row;
                } else {
                    $temp[] = $row;
                }
            }
        }
        return $temp;
    }
public static function arrayChangeKeys($data, $keyName = 'id')
    {
        $temp = [];
        if (is_array($data)) {
            foreach ($data as $key => $row) {
                if (isset($row[$keyName])) {
                    $temp[$row[$keyName]] = $row;
                } else {
                    $temp[] = $row;
                }
            }
        }
        return $temp;
    }
public static function arrayChangeKeys ( $ data , $ keyName = 'id' ) { $ temp = [ ] ; if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ row ) { if ( isset ( $ row [ $ keyName ] ) ) { $ temp [ $ row [ $ keyName ] ] = $ row ; } else { $ temp [ ] = $ row ; } } } return $ temp ; }
Rearange array keys to use selected field from row element

@param  array  $data
@param  string $keyName
@return array
Rearange array keys to use selected field from row element