Skip to content

Commit c843313

Browse files
committed
Update README.md
1 parent 3af6d0f commit c843313

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ But then you want to make sure each translation is unique for its language.
1919

2020
That's where this package comes in to play.
2121

22+
This package also supports [`spatie/nova-translatable`](https://github.com/spatie/nova-translatable/) in case you are using [Laravel Nova](https://nova.laravel.com/).
23+
2224
## ✅ Requirements
2325

2426
- PHP ^7.2
2527
- MySQL >= 5.7
2628
- [Laravel](https://laravel.com/) >= 6 (use v1.* for Laravel 5.*)
2729
- [spatie/laravel-translatable](https://github.com/spatie/laravel-translatable) ^4.2
30+
- [spatie/nova-translatable](https://github.com/spatie/nova-translatable/) ^3.0
2831

2932
## 📦 Installation
3033

@@ -176,6 +179,16 @@ $attributes = request()->validate([
176179
]);
177180
```
178181

182+
### ☑️ Laravel Nova
183+
184+
If you are using [Laravel Nova](https://nova.laravel.com/) in combination with [`spatie/nova-translatable`](https://github.com/spatie/nova-translatable/), then you can add the validation rule like this:
185+
186+
```php
187+
Text::make(__('Slug'), 'slug')
188+
->creationRules('unique_translation:posts,slug')
189+
->updateRules('unique_translation:posts,slug,{{resourceId}}');
190+
```
191+
179192
## 🖥 Example
180193

181194
Your existing `slug` column (JSON) in a `posts` table:

0 commit comments

Comments
 (0)