Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Filament Slug Laravel Package

novius/laravel-filament-slug

View on GitHub
Deep Wiki
Context7

Laravel Filament Slug

Novius CI Packagist Release License: AGPL v3

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium