一键导入
filament-qrcode-field-development
Build and work with the Filament QrCode Field component, including QR code scanning, form integration, and configuration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build and work with the Filament QrCode Field component, including QR code scanning, form integration, and configuration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | filament-qrcode-field-development |
| description | Build and work with the Filament QrCode Field component, including QR code scanning, form integration, and configuration. |
Use this skill when:
This package is a standalone Filament form component (not a panel plugin). It uses:
QrCodeFieldServiceProvider - Registers config, translations, views, and CSS assetsQrCodeInput - The form component class extending TextInputJeffersonGoncalves\Filament\QrCodeField
| Class | Path | Purpose |
|---|---|---|
QrCodeFieldServiceProvider | src/QrCodeFieldServiceProvider.php | Service provider, registers assets |
QrCodeInput | src/Forms/Components/QrCodeInput.php | Form component for QR code input |
composer require jeffersongoncalves/filament-qrcode-field:"^3.0"
php artisan vendor:publish --tag="filament-qrcode-field-config"
php artisan vendor:publish --tag=filament-qrcode-field-translations
config/filament-qrcode-field.php)use Filament\Support\Enums\Width;
return [
'asset_js' => 'https://unpkg.com/html5-qrcode@2.3.8/html5-qrcode.min.js',
'modal' => [
'width' => Width::Large,
],
'reader' => [
'width' => '600px',
'height' => '600px',
],
'scanner' => [
'fps' => 10,
'width' => 250,
'height' => 250,
],
];
use JeffersonGoncalves\Filament\QrCodeField\Forms\Components\QrCodeInput;
QrCodeInput::make('qrcode')
->required(),
QrCodeInput::make('qrcode')
->icon('heroicon-o-qr-code')
->required(),
use JeffersonGoncalves\Filament\QrCodeField\Forms\Components\QrCodeInput;
public static function form(Schema $schema): Schema
{
return $schema
->components([
QrCodeInput::make('barcode')
->label('Product Barcode')
->required(),
]);
}
QrCodeInput extends Filament\Forms\Components\TextInput and adds:
namespace JeffersonGoncalves\Filament\QrCodeField\Forms\Components;
use Filament\Forms\Components\TextInput;
class QrCodeInput extends TextInput
{
protected string $view = 'filament-qrcode-field::components.qrcode-input';
protected function setUp(): void
{
parent::setUp();
$this->placeholder(fn (QrCodeInput $component): string =>
__('filament-qrcode-field::qrcode-field.fields.placeholder', [
'label' => strtolower($component->getLabel())
])
);
}
public function icon(string $icon): static
{
return $this->extraAttributes(['icon' => $icon]);
}
}
Key points:
icon() method passes the icon name via extra attributesThe QrCodeFieldServiceProvider registers:
filament-qrcode-field)FilamentAsset::register()class QrCodeFieldServiceProvider extends PackageServiceProvider
{
public function configurePackage(Package $package): void
{
$package
->name('filament-qrcode-field')
->hasConfigFile()
->hasTranslations()
->hasViews();
}
public function packageBooted(): void
{
FilamentAsset::register(
$this->getAssets(),
$this->getAssetPackageName()
);
}
}
| Package Version | Filament Version |
|---|---|
| 1.x | 3.x |
| 2.x | 4.x |
| 3.x | 5.x |
Cause: The html5-qrcode JavaScript library may not be loaded.
Solution: Check that the asset_js config value points to a valid CDN URL. Ensure no Content Security Policy blocks external scripts.
Cause: Browser or device not granting camera access. Solution: Ensure the site is served over HTTPS (required for camera access). Check browser permissions for the site.
Cause: Default scanner dimensions do not fit the UI.
Solution: Publish the config and adjust reader.width, reader.height, scanner.width, and scanner.height values.
Cause: Translation files not published or label not set.
Solution: Ensure the field has a ->label() set, or publish translations with --tag=filament-qrcode-field-translations.