original_string: public function deleteCrudImages($data, $rows)
      {
          foreach ($rows as $row) {
              $this->deleteFileIfExists($data->{$row->field});
  
              $options = json_decode($row->details);
  
              if (isset($options->thumbnails)) {
                  foreach ($options->thumbnails as $thumbnail) {
                      $ext = explode('.', $data->{$row->field});
                      $extension = '.'.$ext[count($ext) - 1];
  
                      $path = str_replace($extension, '', $data->{$row->field});
  
                      $thumb_name = $thumbnail->name;
  
                      $this->deleteFileIfExists($path.'-'.$thumb_name.$extension);
                  }
              }
          }
  
          if ($rows->count() > 0) {
              event(new CrudImagesDeleted($data, $rows));
          }
      }
code: public function deleteCrudImages($data, $rows)
      {
          foreach ($rows as $row) {
              $this->deleteFileIfExists($data->{$row->field});
  
              $options = json_decode($row->details);
  
              if (isset($options->thumbnails)) {
                  foreach ($options->thumbnails as $thumbnail) {
                      $ext = explode('.', $data->{$row->field});
                      $extension = '.'.$ext[count($ext) - 1];
  
                      $path = str_replace($extension, '', $data->{$row->field});
  
                      $thumb_name = $thumbnail->name;
  
                      $this->deleteFileIfExists($path.'-'.$thumb_name.$extension);
                  }
              }
          }
  
          if ($rows->count() > 0) {
              event(new CrudImagesDeleted($data, $rows));
          }
      }
code_tokens: public function deleteCrudImages ( $ data , $ rows ) { foreach ( $ rows as $ row ) { $ this -> deleteFileIfExists ( $ data -> { $ row -> field } ) ; $ options = json_decode ( $ row -> details ) ; if ( isset ( $ options -> thumbnails ) ) { foreach ( $ options -> thumbnails as $ thumbnail ) { $ ext = explode ( '.' , $ data -> { $ row -> field } ) ; $ extension = '.' . $ ext [ count ( $ ext ) - 1 ] ; $ path = str_replace ( $ extension , '' , $ data -> { $ row -> field } ) ; $ thumb_name = $ thumbnail -> name ; $ this -> deleteFileIfExists ( $ path . '-' . $ thumb_name . $ extension ) ; } } } if ( $ rows -> count ( ) > 0 ) { event ( new CrudImagesDeleted ( $ data , $ rows ) ) ; } }
docstring: Delete all images related to a CRUD item.
  
  @param \Illuminate\Database\Eloquent\Model $data
  @param \Illuminate\Database\Eloquent\Model $rows
  
  @return void
docstring_tokens: Delete all images related to a CRUD item .