drobee / nova-slug-field

Slug field for Laravel Nova

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Nova Slug Field

Simple Laravel Nova Slug field. Generating a slugified version of a text input. See the result of the slug while typing.

Edit form

details page select

Installation

In order to use this package, you need a Laravel installation which uses Nova.

Composer

composer require benjaminhirsch/nova-slug-field

Usage

Define the following fields in your resource in the fields method:

use Benjaminhirsch\NovaSlugField\Slug;
use Benjaminhirsch\NovaSlugField\TextWithSlug;

...

TextWithSlug::make('Name')
    ->slug('Slug'),

Slug::make('Slug'),

This first field definition is the field which you want to create the slug of. The second field definition represents the slugified version. With the ->slug('name') method, you define the name of the field which holds the slug. It is possible to create multiple slugs on a single resource, just add more field definitions. Every TextWithSlug field needs a corresponding Slug field.

About

Slug field for Laravel Nova

License:MIT License


Languages

Language:Vue 68.6%Language:PHP 20.5%Language:JavaScript 10.7%Language:CSS 0.2%