momenoor/filament-serial
最新稳定版本:v1.0.0
Composer 安装命令:
composer require momenoor/filament-serial
包简介
A Filament V3 form macro for `TextInput` that allows you to easily format and manage serial numbers with optional prefixes, suffixes, separators, and padded digits.
README 文档
README
A Filament V3 form macro for TextInput that allows you to easily format and manage serial numbers with optional prefixes, suffixes, separators, and padded digits.
✨ Features
- Format serial numbers in Filament forms.
- Support for:
- Prefix and/or suffix
- Custom separator
- Fixed digit zero-padded numeric part
- Automatically formats on blur and focus
- Saves only numeric part to database
- Built-in Alpine.js interactivity
- Simple integration with Filament
TextInput
📦 Installation
You can install the package via Composer:
composer require momenoor/filament-serial
This package auto-registers itself. No need to publish anything.
⚙️ Usage
use Filament\Forms\Components\TextInput; TextInput::make('serial_number') ->label('Serial Number') ->serial( prefix: 'INV', // Optional string or Closure suffix: 'UAE', // Optional string or Closure separator: '-', // Default is "-" length: 6 // Default is 8 );
Example
| Interaction | Value Example |
|---|---|
| On blur | INV-000123-UAE |
| On focus | 123 |
| In database | 000123 |
🛠 Parameters
| Parameter | Type | Description |
|---|---|---|
prefix |
string|Closure | Text before the numeric part |
suffix |
string|Closure | Text after the numeric part |
separator |
string | String between segments (default: -) |
length |
int | Number of digits in the numeric part (default: 8) |
✅ Compatibility
- Laravel 10+
- Filament 3.x
- PHP 8.1+
📄 Changelog
Please see CHANGELOG for more information on recent changes.
🤝 Contributing
Please see CONTRIBUTING for details.
🔐 Security
If you discover any security-related issues, please review the security policy.
🙌 Credits
📜 License
The MIT License (MIT). Please see LICENSE for more information.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-08