X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/b94b945fb03e21a1997cfe6e50148967586cb26d..refs/pull/5676/head:/app/Api/ApiToken.php diff --git a/app/Api/ApiToken.php b/app/Api/ApiToken.php index 523c3b8b8..ca89c813e 100644 --- a/app/Api/ApiToken.php +++ b/app/Api/ApiToken.php @@ -1,15 +1,31 @@ - 'date:Y-m-d' + 'expires_at' => 'date:Y-m-d', ]; /** @@ -28,4 +44,20 @@ class ApiToken extends Model { return Carbon::now()->addYears(100)->format('Y-m-d'); } + + /** + * {@inheritdoc} + */ + public function logDescriptor(): string + { + return "({$this->id}) {$this->name}; User: {$this->user->logDescriptor()}"; + } + + /** + * Get the URL for managing this token. + */ + public function getUrl(string $path = ''): string + { + return url("/http/source.bookstackapp.com/api-tokens/{$this->user_id}/{$this->id}/" . trim($path, '/')); + } }