Skip to content

Commit

Permalink
Inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminhirsch committed Aug 25, 2018
1 parent 48e7209 commit 73cacfa
Show file tree
Hide file tree
Showing 19 changed files with 13,071 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.idea
/vendor
/node_modules
package-lock.json
composer.phar
composer.lock
phpunit.xml
.phpunit.result.cache
.DS_Store
Thumbs.db
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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.

### Details Page

![details page select](https://raw.githubusercontent.com/benjaminhirsch/benjaminhirsch.github.io/master/repository-assets/nova-slug-demo.gif)

## Installation

In order to use this package, you need a Laravel installation which uses [Nova](https://nova.laravel.com).

**Composer**

```bash
composer require benjaminhirsch/nova-slug-field
```

## Usage

```
TextWithSlug::make('Name')
->sortable()
->slug('Slug')
->rules('required', 'max:255'),
Slug::make('Slug')
->rules('required', 'max:255'),
```

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.
40 changes: 40 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "benjaminhirsch/nova-slug-field",
"description": "A Laravel Nova field to generate a slugs.",
"keywords": [
"laravel",
"nova"
],
"authors": [
{
"name": "Benjamin Hirsch",
"email": "[email protected]",
"role": "Developer",
"homepage": "https://wwwbenjaminhirsch.net"
}
],
"support": {
"issues": "https://github.com/benjaminhirsch/nova-slug-field/issues"
},
"license": "MIT",
"require": {
"php": ">=7.1.0"
},
"autoload": {
"psr-4": {
"Benjaminhirsch\\NovaSlugField\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Benjaminhirsch\\NovaSlugField\\FieldServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Empty file added dist/css/field.css
Empty file.
Loading

0 comments on commit 73cacfa

Please sign in to comment.