Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('generateToken')
->label('Generate Token')
->button()
->hidden(fn(string $operation) => $operation === "create")
->requiresConfirmation(fn(Client $client) => $client->tokens()->exists())
->modalHeading('Generate new Token')
->modalDescription('Are you sure you want to generate a new Token? Existing ones will be deleted.')
->action(function (Client $client) {
$tokenName = $client->client_name;
$client->tokens()->delete();
$token = $client->createToken($tokenName, ['server:update'])->plainTextToken;
//show a modal that displays the plainTextToken
dump($token);
}),
]),
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('generateToken')
->label('Generate Token')
->button()
->hidden(fn(string $operation) => $operation === "create")
->requiresConfirmation(fn(Client $client) => $client->tokens()->exists())
->modalHeading('Generate new Token')
->modalDescription('Are you sure you want to generate a new Token? Existing ones will be deleted.')
->action(function (Client $client) {
$tokenName = $client->client_name;
$client->tokens()->delete();
$token = $client->createToken($tokenName, ['server:update'])->plainTextToken;
//show a modal that displays the plainTextToken
dump($token);
}),
]),