mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 06:26:52 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Extensions\Captcha\Schemas;
 | 
						|
 | 
						|
use Filament\Forms\Components\Component;
 | 
						|
use Filament\Forms\Components\TextInput;
 | 
						|
use Illuminate\Support\Str;
 | 
						|
 | 
						|
abstract class BaseSchema
 | 
						|
{
 | 
						|
    abstract public function getId(): string;
 | 
						|
 | 
						|
    public function getName(): string
 | 
						|
    {
 | 
						|
        return Str::upper($this->getId());
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * @return array<string, string|string[]|bool|null>
 | 
						|
     */
 | 
						|
    public function getConfig(): array
 | 
						|
    {
 | 
						|
        $id = Str::upper($this->getId());
 | 
						|
 | 
						|
        return [
 | 
						|
            'site_key' => env("CAPTCHA_{$id}_SITE_KEY"),
 | 
						|
            'secret_key' => env("CAPTCHA_{$id}_SECRET_KEY"),
 | 
						|
        ];
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * @return Component[]
 | 
						|
     */
 | 
						|
    public function getSettingsForm(): array
 | 
						|
    {
 | 
						|
        $id = Str::upper($this->getId());
 | 
						|
 | 
						|
        return [
 | 
						|
            TextInput::make("CAPTCHA_{$id}_SITE_KEY")
 | 
						|
                ->label('Site Key')
 | 
						|
                ->placeholder('Site Key')
 | 
						|
                ->columnSpan(2)
 | 
						|
                ->required()
 | 
						|
                ->password()
 | 
						|
                ->revealable()
 | 
						|
                ->autocomplete(false)
 | 
						|
                ->default(env("CAPTCHA_{$id}_SITE_KEY")),
 | 
						|
            TextInput::make("CAPTCHA_{$id}_SECRET_KEY")
 | 
						|
                ->label('Secret Key')
 | 
						|
                ->placeholder('Secret Key')
 | 
						|
                ->columnSpan(2)
 | 
						|
                ->required()
 | 
						|
                ->password()
 | 
						|
                ->revealable()
 | 
						|
                ->autocomplete(false)
 | 
						|
                ->default(env("CAPTCHA_{$id}_SECRET_KEY")),
 | 
						|
        ];
 | 
						|
    }
 | 
						|
}
 |