@@ -11,7 +11,7 @@ |
||
| 11 | 11 | protected $namespace = 'Modules\Translation\Http\Controllers'; |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @return string |
|
| 14 | + * @return boolean |
|
| 15 | 15 | */ |
| 16 | 16 | protected function getFrontendRoute() |
| 17 | 17 | { |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | * Do we have an English version of the key? If we do, it usually means that |
| 67 | 67 | * there hasn't been a translation entered in the CMS, so we don't need to rebuild the |
| 68 | 68 | * translation cache just because it's not been entered in the CMS. |
| 69 | - * @param $key |
|
| 69 | + * @param string $key |
|
| 70 | 70 | * @return bool |
| 71 | 71 | */ |
| 72 | 72 | protected function isTranslationCachedInEnglish($key) |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param bool $fallback |
| 29 | 29 | * @return string |
| 30 | 30 | */ |
| 31 | - public function get($key, array $replace = [], $locale = null, $fallback = true) |
|
| 31 | + public function get($key, array $replace = [ ], $locale = null, $fallback = true) |
|
| 32 | 32 | { |
| 33 | 33 | $translationRepository = app(TranslationRepository::class); |
| 34 | 34 | if ($translation = $translationRepository->findByKeyAndLocale($key, $locale)) { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | protected function shouldRebuildCache($key) |
| 49 | 49 | { |
| 50 | - if (! app()->isBooted()) { |
|
| 50 | + if (!app()->isBooted()) { |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | if ($this->isTranslationCachedInEnglish($key)) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function isTranslationCachedInEnglish($key) |
| 73 | 73 | { |
| 74 | - $translation = parent::get($key, [], 'en'); |
|
| 74 | + $translation = parent::get($key, [ ], 'en'); |
|
| 75 | 75 | |
| 76 | 76 | return $key !== $translation; |
| 77 | 77 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function up() |
| 13 | 13 | { |
| 14 | - Schema::create('translation__translations', function (Blueprint $table) { |
|
| 14 | + Schema::create('translation__translations', function(Blueprint $table) { |
|
| 15 | 15 | $table->engine = 'InnoDB'; |
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('key'); |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('translation__translation_translations', function (Blueprint $table) { |
|
| 15 | + Schema::create('translation__translation_translations', function(Blueprint $table) { |
|
| 16 | 16 | $table->engine = 'InnoDB'; |
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->text('value'); |
| 19 | 19 | |
| 20 | 20 | $table->integer('translation_id')->unsigned(); |
| 21 | 21 | $table->string('locale')->index(); |
| 22 | - $table->unique(['translation_id', 'locale'], 'translations_trans_id_locale_unique'); |
|
| 22 | + $table->unique([ 'translation_id', 'locale' ], 'translations_trans_id_locale_unique'); |
|
| 23 | 23 | $table->foreign('translation_id')->references('id')->on('translation__translations')->onDelete('cascade'); |
| 24 | 24 | }); |
| 25 | 25 | } |
@@ -8,6 +8,6 @@ |
||
| 8 | 8 | use Translatable; |
| 9 | 9 | |
| 10 | 10 | protected $table = 'translation__translations'; |
| 11 | - public $translatedAttributes = ['value']; |
|
| 12 | - protected $fillable = ['key', 'value']; |
|
| 11 | + public $translatedAttributes = [ 'value' ]; |
|
| 12 | + protected $fillable = [ 'key', 'value' ]; |
|
| 13 | 13 | } |
@@ -5,6 +5,6 @@ |
||
| 5 | 5 | class TranslationTranslation extends Model |
| 6 | 6 | { |
| 7 | 7 | public $timestamps = false; |
| 8 | - protected $fillable = ['value']; |
|
| 8 | + protected $fillable = [ 'value' ]; |
|
| 9 | 9 | protected $table = 'translation__translation_translations'; |
| 10 | 10 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function export() |
| 27 | 27 | { |
| 28 | 28 | $data = $this->formatData(); |
| 29 | - $keys = array_keys($data[0]); |
|
| 29 | + $keys = array_keys($data[ 0 ]); |
|
| 30 | 30 | |
| 31 | 31 | $csv = Writer::createFromFileObject(new SplTempFileObject()); |
| 32 | 32 | $csv->insertOne($keys); |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | $translations = $this->translations->getFileAndDatabaseMergedTranslations(); |
| 51 | 51 | $translations = $translations->all(); |
| 52 | 52 | |
| 53 | - $data = []; |
|
| 53 | + $data = [ ]; |
|
| 54 | 54 | foreach ($translations as $key => $translation) { |
| 55 | - $data[] = array_merge(['key' => $key], $translation); |
|
| 55 | + $data[ ] = array_merge([ 'key' => $key ], $translation); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return $data; |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | public function rules() |
| 8 | 8 | { |
| 9 | 9 | return [ |
| 10 | - 'file' => ['required', 'extensions:csv'], |
|
| 10 | + 'file' => [ 'required', 'extensions:csv' ], |
|
| 11 | 11 | ]; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -8,4 +8,4 @@ |
||
| 8 | 8 | 'as' => 'api.translation.translations.update' |
| 9 | 9 | ]); |
| 10 | 10 | |
| 11 | -post('translation/clearCache', ['uses' => 'TranslationController@clearCache', 'as' => 'api.translation.translations.clearCache']); |
|
| 11 | +post('translation/clearCache', [ 'uses' => 'TranslationController@clearCache', 'as' => 'api.translation.translations.clearCache' ]); |
|