Jake Vanderwerf
2 days ago 235ce5716edc2f7cbe80fdccf26eac7269587839
inc/managers/KarmaManager.php
@@ -60,7 +60,7 @@
//          break;
//    }
      if (!isset(self::$cache)) {
         self::$cache = Cache::for('user_karma')->connect('user');
         self::$cache = Cache::for('user_karma')->connect('user')->user();
      }
      add_filter(BASE.'handle_bulk_operation', [$this, 'processOperation'], 10, 3);
@@ -122,7 +122,7 @@
   protected function defineTable():bool
   {
      $table = CustomTable::for('karma_'.$this->key);
      [$type, $table, $column] = $this->getReferenceTable($table);
      [$type, $referenceTable, $column] = $this->getReferenceTable($table);
      if (!$type) {
         error_log('[KarmaManager]::defineTable Attempted to build reference for invalid table: '.$this->references);
         CustomTable::destroyInstance('karma_'.$this->key);
@@ -134,7 +134,7 @@
         'item_id'   => "{$type} NOT NULL",
         'user_id'   => "{$table->getUserIDType()} NOT NULL",
         'content'   => 'varchar(255) NOT NULL',
         'vote'      => "ENUM('up,'down') NOT NULL",
         'vote'      => "ENUM('up','down') NOT NULL",
         'created_at'=> 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP',
         'updated_at'=> 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
      ]);
@@ -147,9 +147,9 @@
      ]);
      $base = BASE;
      $table->setConstraints([
         "CONSTRAINT `{$base}kt_{$type}_item_id` FOREIGN KEY (`item_id`)
         REFERENCES `{$table}` (`{$column}`) ON DELETE CASCADE",
         "CONSTRAINT `{$base}kt_{$type}_user_id` FOREIGN KEY (`user_id`)
         "CONSTRAINT `{$base}kt_{$this->key}_{$type}_item_id` FOREIGN KEY (`item_id`)
         REFERENCES `{$referenceTable}` (`{$column}`) ON DELETE CASCADE",
         "CONSTRAINT `{$base}kt_{$this->key}_{$type}_user_id` FOREIGN KEY (`user_id`)
         REFERENCES `{$table->getUserTable()}` (`ID`) ON DELETE CASCADE"
      ]);
      $table->defineTable();