novius/laravel-filament-slug
Introduction
This package add a Slug field to Filament Forms
Requirements
- PHP >= 8.2
- Laravel >= 11.0
- Laravel Filament >= 4
Installation
composer require novius/laravel-filament-slug
Usage
class YourResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([
$title = TextInput::make('title')
->required(),
Slug::make('slug')
// First parameter of fromField() must be the TextInput instance from which the slug is generated.
// Second parameter is optional. If passed, must be a closure returning if the slug generation should be skip or not.
->fromField($title, fn (Get $get) => ! $get('other_value'))
// Slug inherit from TextInput. You can use all other method of TextInput.
->required()
->string()
->regex('/^(\/|[a-zA-Z0-9-_]+)$/')
->unique(
YourModel::class,
'slug',
ignoreRecord: true
),
]);
}
}
Lint
Run php-cs with:
composer run-script lint
Contributing
Contributions are welcome!
Leave an issue on GitHub, or create a Pull Request.
Licence
This package is under GNU Affero General Public License v3 or (at your option) any later version.
Related Packages
heloufir/filament-leaflet-geosearch
Implementation of LeafLet GeoSearch as a Filament Form Field
2,124
22
novadaemon/filament-pretty-json
Read-only field to show pretty json in your filamentphp forms
624,862
47
barryvdh/laravel-form-bridge
This packages integrates Symfony Form Component in Laravel.
394,532
160
novadaemon/filament-combobox
Side by side combobox multiselect field to use in your FilamentPHP forms
37,329
26
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.1 | >=8.2 | AGPL-3.0-or-later | ||
| 1.0.0 | >=8.2 | ^11.0 | | AGPL-3.0-or-later |