authentikate/app/Livewire/ManageAuthenticationTokens.php
Javier Feliz 038ee47fa3
All checks were successful
linter / quality (push) Successful in 3m8s
tests / ci (push) Successful in 13m56s
Claude be codin
2025-07-31 00:56:12 -04:00

43 lines
940 B
PHP

<?php
namespace App\Livewire;
use App\Models\AuthenticationToken;
use Illuminate\Support\Facades\Auth;
use Livewire\Attributes\Computed;
use Livewire\Component;
class ManageAuthenticationTokens extends Component
{
#[Computed]
public function tokens()
{
/** @var \App\Models\User $user */
$user = Auth::user();
return $user->tokens()
->with('application')
->orderBy('issued_at', 'desc')
->get()
->groupBy('application.name')
->sortKeys();
}
public function revokeToken($tokenId)
{
$token = AuthenticationToken::where('id', $tokenId)
->where('user_id', Auth::id())
->first();
if ($token) {
$token->delete();
$this->dispatch('token-revoked');
}
}
public function render()
{
return view('livewire.manage-authentication-tokens');
}
}