Simplify and restrict api keys

This commit is contained in:
Lance Pioch 2024-04-12 13:05:04 -04:00
parent 05e9f12dc4
commit 99693367d3
2 changed files with 4 additions and 0 deletions

View File

@ -46,6 +46,7 @@ class ApiKeyResource extends Resource
Forms\Components\Hidden::make('token')->default(encrypt(str_random(ApiKey::KEY_LENGTH))),
Forms\Components\Select::make('user_id')
->hidden()
->searchable()
->preload()
->relationship('user', 'username')
@ -66,6 +67,7 @@ class ApiKeyResource extends Resource
->filter(fn ($value, $key) => $key <= ApiKey::TYPE_APPLICATION || $apiKey->key_type === $key)
->all();
})
->hidden()
->selectablePlaceholder(false)
->required()
->default(ApiKey::TYPE_APPLICATION),

View File

@ -9,4 +9,6 @@ use Filament\Resources\Pages\CreateRecord;
class CreateApiKey extends CreateRecord
{
protected static string $resource = ApiKeyResource::class;
protected ?string $heading = 'Create Application API Key';
}