original_string: 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);
                  }
              }
          }
      }
code: 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);
                  }
              }
          }
      }
code_tokens: 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 ) ; } } } }
docstring: Remove translations, images and files related to a CRUD item.
  
  @param \Illuminate\Database\Eloquent\Model $dataType
  @param \Illuminate\Database\Eloquent\Model $data
  
  @return void
docstring_tokens: Remove translations images and files related to a CRUD item .