Skip to content

Commit

Permalink
Make php artisan api-key:delete actually delete
Browse files Browse the repository at this point in the history
The API key passed to the command is found, and its existence is checked, but it is never actually revoked.  Since the model uses SoftDeletes, we can use `$apiKey->delete()` to revoke the key.  Note that this means the command doesn't actually support *deleting* the key unless the model has been replaced in the app config by a model class that doesn't support soft deletes.  We could probably add a flag to specify that the command should use `->forceDelete()` instead, but I haven't opted to do so at this point, erring instead on the side of changing as little as possible.

This PR adds the `->delete()` line so the artisan command will actually revoke the key.
  • Loading branch information
danhunsaker committed May 24, 2016
1 parent 8f8c551 commit 21126fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Console/Commands/DeleteApiKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ public function fire()
return;
}

$this->info("The API key {$key} was deleted.");
$apiKey->delete();

$this->info("The API key {$key} was deleted.");
return;
}

Expand Down Expand Up @@ -86,4 +87,4 @@ protected function getOptions()
);
}

}
}

0 comments on commit 21126fa

Please sign in to comment.