Update EditProfile (#368)

* Update EditProfile.php
This commit is contained in:
MartinOscar 2024-06-11 20:32:55 +02:00 committed by GitHub
parent 6d6b50c27d
commit f216376265
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -193,8 +193,10 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
->schema([ ->schema([
Grid::make('asdf')->columns(5)->schema([ Grid::make('asdf')->columns(5)->schema([
Section::make('Create API Key')->columnSpan(3)->schema([ Section::make('Create API Key')->columnSpan(3)->schema([
TextInput::make('description')->required(), TextInput::make('description')
->live(),
TagsInput::make('allowed_ips') TagsInput::make('allowed_ips')
->live()
->splitKeys([',', ' ', 'Tab']) ->splitKeys([',', ' ', 'Tab'])
->placeholder('Example: 127.0.0.1 or 192.168.1.1') ->placeholder('Example: 127.0.0.1 or 192.168.1.1')
->label('Whitelisted IP\'s') ->label('Whitelisted IP\'s')
@ -202,6 +204,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
->columnSpanFull(), ->columnSpanFull(),
])->headerActions([ ])->headerActions([
Action::make('Create') Action::make('Create')
->disabled(fn (Get $get) => $get('description') === null)
->successRedirectUrl(route('filament.admin.auth.profile', ['tab' => '-api-keys-tab'])) ->successRedirectUrl(route('filament.admin.auth.profile', ['tab' => '-api-keys-tab']))
->action(function (Get $get, Action $action, $user) { ->action(function (Get $get, Action $action, $user) {
$token = $user->createToken( $token = $user->createToken(