Skip to content

Commit

Permalink
Bugfix registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner committed Aug 9, 2019
1 parent 91d5f09 commit e7efe26
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Commands/HandlersRegister.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ public function run(array $params = [])
endif;

// Get an instance of the model
$config = config($configClass);
$config = new $configClass();
$model = new $config->model();

// Load each handler
foreach ($handlers as $handlerClass):

// Get the attributes from the adapter itself
// Get the attributes from the handler itself
$handler = new $handlerClass();
$row = $handler->attributes;
$row['class'] = $handlerClass;

// Check for an existing adapter registration
if ($handlerId = $model->where('uid', $row['uid'])->first()):
// Check for an existing registration
if ($existing = $model->where('uid', $row['uid'])->first()):
// Update it
$model->where('uid', $row->uid)->update($row);
$model->update($existing->id, $row);
else:
// Create a new registration
$handlerId = $model->insert($row);
Expand Down

0 comments on commit e7efe26

Please sign in to comment.