protected function cleanup($dataType, $data)
    {
        // Delete Translations, if present
        if (is_crud_translatable($data)) {
            $data->deleteAttributeTranslations($data->getTranslatableAttributes());
        }

        // Delete Images
        $this->deleteCrudImages($data, $dataType->deleteRows->where('type', 'image'));

        // Delete Files
        foreach ($dataType->deleteRows->where('type', 'file') as $row) {
            $files = json_decode($data->{$row->field});
            if ($files) {
                foreach ($files as $file) {
                    $this->deleteFileIfExists($file->download_link);
                }
            }
        }
    }
protected function cleanup($dataType, $data)
    {
        // Delete Translations, if present
        if (is_crud_translatable($data)) {
            $data->deleteAttributeTranslations($data->getTranslatableAttributes());
        }

        // Delete Images
        $this->deleteCrudImages($data, $dataType->deleteRows->where('type', 'image'));

        // Delete Files
        foreach ($dataType->deleteRows->where('type', 'file') as $row) {
            $files = json_decode($data->{$row->field});
            if ($files) {
                foreach ($files as $file) {
                    $this->deleteFileIfExists($file->download_link);
                }
            }
        }
    }
protected function cleanup ( $ dataType , $ data ) { // Delete Translations, if present if ( is_crud_translatable ( $ data ) ) { $ data -> deleteAttributeTranslations ( $ data -> getTranslatableAttributes ( ) ) ; } // Delete Images $ this -> deleteCrudImages ( $ data , $ dataType -> deleteRows -> where ( 'type' , 'image' ) ) ; // Delete Files foreach ( $ dataType -> deleteRows -> where ( 'type' , 'file' ) as $ row ) { $ files = json_decode ( $ data -> { $ row -> field } ) ; if ( $ files ) { foreach ( $ files as $ file ) { $ this -> deleteFileIfExists ( $ file -> download_link ) ; } } } }
Remove translations, images and files related to a CRUD item.

@param \Illuminate\Database\Eloquent\Model $dataType
@param \Illuminate\Database\Eloquent\Model $data

@return void
Remove translations images and files related to a CRUD item .