public static function deleteLangDataRecord($parameters)
    {
        $instance   = new static;
        $object     = $instance::find($parameters['id']);

        if($object != null)
        {
            $jsonObject = json_decode($object->{'data_lang_' . $instance->suffix});

            //unset isn't correct, get error to reorder array
            $newArrayLang = [];
            foreach($jsonObject->langs as $keyLang)
            {
                if($keyLang != $parameters['lang'])
                {
                    $newArrayLang[] = $keyLang;
                }
            }
            $jsonObject->langs = $newArrayLang;
            $jsonString = json_encode($jsonObject);

            $instance::where($instance->getKeyName(), $parameters['id'])->update([
                'data_lang_' . $instance->suffix  => $jsonString
            ]);
        }
    }
public static function deleteLangDataRecord($parameters)
    {
        $instance   = new static;
        $object     = $instance::find($parameters['id']);

        if($object != null)
        {
            $jsonObject = json_decode($object->{'data_lang_' . $instance->suffix});

            //unset isn't correct, get error to reorder array
            $newArrayLang = [];
            foreach($jsonObject->langs as $keyLang)
            {
                if($keyLang != $parameters['lang'])
                {
                    $newArrayLang[] = $keyLang;
                }
            }
            $jsonObject->langs = $newArrayLang;
            $jsonString = json_encode($jsonObject);

            $instance::where($instance->getKeyName(), $parameters['id'])->update([
                'data_lang_' . $instance->suffix  => $jsonString
            ]);
        }
    }
public static function deleteLangDataRecord ( $ parameters ) { $ instance = new static ; $ object = $ instance :: find ( $ parameters [ 'id' ] ) ; if ( $ object != null ) { $ jsonObject = json_decode ( $ object -> { 'data_lang_' . $ instance -> suffix } ) ; //unset isn't correct, get error to reorder array $ newArrayLang = [ ] ; foreach ( $ jsonObject -> langs as $ keyLang ) { if ( $ keyLang != $ parameters [ 'lang' ] ) { $ newArrayLang [ ] = $ keyLang ; } } $ jsonObject -> langs = $ newArrayLang ; $ jsonString = json_encode ( $ jsonObject ) ; $ instance :: where ( $ instance -> getKeyName ( ) , $ parameters [ 'id' ] ) -> update ( [ 'data_lang_' . $ instance -> suffix => $ jsonString ] ) ; } }
Function to delete lang record from json field

@access  public
@param   array   $parameters     [id, lang]
@return  void
Function to delete lang record from json field