diff --git a/composer.json b/composer.json index 45b349e00c6f4b13f7ae75e580ea9fddd8430731..f8f9e69ba27133f8aa452f4c681f7acc2b9aadc7 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "license": "MIT", "require": { "php": ">=7.1.0", - "dimsav/laravel-translatable": "^9.0" + "astrotomic/laravel-translatable": "^11.1" }, "autoload": { "psr-4": { diff --git a/readme.md b/readme.md index 7d5750cde3c33132a71d9d125378761d1d41fef9..4c2b6a6e3b6327dc878b131ceee6fa505c6cf60b 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ This package is based on [mrmonat/nova-translatable](https://github.com/mrmonat/nova-translatable). -Adds the ability to show and edit translated fields created with [dimsav/laravel-translatable](https://github.com/dimsav/laravel-translatable) package. +Adds the ability to show and edit translated fields created with [astrotomic/laravel-translatable](https://github.com/Astrotomic/laravel-translatable) package. It will show up in the detail view like this: @@ -30,7 +30,7 @@ Translatable::make('Description'), Make sure, that you have your Eloquent model setup correct: -- First, you need to add the `Dimsav\Translatable\Translatable`-trait. +- First, you need to add the `Astrotomic\Translatable\Translatable`-trait. - Next, you should create a public property `$translatedAttributes` which holds an array with all the names of attributes you wish to make translatable. - Finally, you should make sure that all translatable attributes are set to the `text`-datatype in your database. If your database supports `json`-columns, use that. @@ -38,7 +38,7 @@ Here's an example of a prepared model: ``` php use Illuminate\Database\Eloquent\Model; -use Dimsav\Translatable\Translatable; +use Astrotomic\Translatable\Translatable; class NewsItem extends Model { diff --git a/src/Translatable.php b/src/Translatable.php index 160fb60cb76158601cdec96205bd7e80c8ea2742..bf3ca293ea741045d6aa1f688bf9898b4dc791bd 100644 --- a/src/Translatable.php +++ b/src/Translatable.php @@ -48,7 +48,7 @@ class Translatable extends Field $results = []; if ( class_exists('\Spatie\Translatable\TranslatableServiceProvider') && method_exists($resource, 'getTranslations') ) { $results = $resource->getTranslations($attribute); - } elseif ( class_exists('\Dimsav\Translatable\TranslatableServiceProvider') && method_exists($resource, 'translations') ) { + } elseif ( class_exists('\Astrotomic\Translatable\TranslatableServiceProvider') && method_exists($resource, 'translations') ) { $results = $resource->translations->pluck($attribute, config('translatable.locale_key')); } else { $results = data_get($resource, $attribute); @@ -67,7 +67,7 @@ class Translatable extends Field */ protected function fillAttributeFromRequest(NovaRequest $request, $requestAttribute, $model, $attribute) { - if ( class_exists('\Dimsav\Translatable\TranslatableServiceProvider') && method_exists($model, 'translateOrNew') ) { + if ( class_exists('\Astrotomic\Translatable\TranslatableServiceProvider') && method_exists($model, 'translateOrNew') ) { if ( is_array($request[$requestAttribute]) ) { foreach ( $request[$requestAttribute] as $lang => $value ) { $model->translateOrNew($lang)->{$attribute} = $value;