diff --git a/app/Http/Livewire/PersonalAccessTokens.php b/app/Http/Livewire/PersonalAccessTokens.php new file mode 100644 index 0000000000..c9e30a9430 --- /dev/null +++ b/app/Http/Livewire/PersonalAccessTokens.php @@ -0,0 +1,40 @@ + Auth::user()->tokens, + ]); + } + + public function rules(): array + { + return [ + 'name' => 'required', + 'scopes' => 'nullable|array', + ]; + } + + public function createToken(): void + { + Auth::user()->createToken($this->name, $this->scopes); + } + + public function deleteToken($tokenId): void + { + Auth::user()->tokens()->where('id', $tokenId)->delete(); + } + + public function getTokensProperty(): array + { + return Auth::user()->tokens; + } +} diff --git a/resources/views/account/api.blade.php b/resources/views/account/api.blade.php index 2e97c99748..8098ea7e35 100644 --- a/resources/views/account/api.blade.php +++ b/resources/views/account/api.blade.php @@ -18,8 +18,10 @@ {{-- token-url="{{ url('oauth/personal-access-tokens') }}"--}} {{-- scopes-url="{{ url('oauth/scopes') }}">--}} {{-- --}} - {{-- New Component --}} - + {{-- New Blade Component --}} +{{-- --}} + {{-- New Livewire Component --}} + @else

{{ trans('general.feature_disabled') }}

@endif diff --git a/resources/views/livewire/personal-access-tokens.blade.php b/resources/views/livewire/personal-access-tokens.blade.php new file mode 100644 index 0000000000..6f8fcaeb78 --- /dev/null +++ b/resources/views/livewire/personal-access-tokens.blade.php @@ -0,0 +1,85 @@ +@props([ + 'token_url' => url('oauth/personal-access-tokens'), + 'scopes_url' => url('oauth/scopes'), +]) + +
+

New Personal Access Token Component

+
+

{{ $token_url }}

+

{{ $scopes_url }}

+
+ +
+ +
+ + @if($tokens->count() === 0) +

+ You have not created any personal access tokens. +

+ @endif + + + + @if($tokens->count() > 0) + + + + + + + + + @endif + @foreach($tokens as $token) + + + + + + + + + + + + + + + @endforeach + +
NameCreatedExpiresDelete
+ {{ $token->name }} + + {{ $token->created_at }} + + {{ $token->expires_at }} + + + + +
+
+ + + +
+ + + + + + + +
\ No newline at end of file