@@ -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 | { |
@@ -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 | } |
@@ -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 | |
@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | public function import(UploadedFile $file) |
| 20 | 20 | { |
| 21 | 21 | $csv = Reader::createFromPath($file->getRealPath()); |
| 22 | - $csv->detectDelimiterList(5, [',', ';']); |
|
| 22 | + $csv->detectDelimiterList(5, [ ',', ';' ]); |
|
| 23 | 23 | $headers = $csv->fetchOne(); |
| 24 | 24 | $csv->setOffset(1); |
| 25 | 25 | |
| 26 | - $csv->each(function ($row) use ($headers) { |
|
| 26 | + $csv->each(function($row) use ($headers) { |
|
| 27 | 27 | try { |
| 28 | 28 | $row = array_combine($headers, $row); |
| 29 | 29 | } catch (\Exception $e) { |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $key = array_get($row, 'key'); |
| 34 | 34 | array_shift($row); |
| 35 | - $data = []; |
|
| 35 | + $data = [ ]; |
|
| 36 | 36 | foreach ($row as $locale => $value) { |
| 37 | - $data[$locale] = ['value' => $value]; |
|
| 37 | + $data[ $locale ] = [ 'value' => $value ]; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $this->translation->updateFromImport($key, $data); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | return $this->cache |
| 23 | 23 | ->tags($this->entityName, 'global') |
| 24 | 24 | ->rememberForever("{$this->locale}.{$this->entityName}.findByKeyAndLocale.{$key}.{$locale}", |
| 25 | - function () use ($key, $locale) { |
|
| 25 | + function() use ($key, $locale) { |
|
| 26 | 26 | return $this->repository->findByKeyAndLocale($key, $locale); |
| 27 | 27 | } |
| 28 | 28 | ); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | return $this->cache |
| 34 | 34 | ->tags($this->entityName, 'global') |
| 35 | 35 | ->rememberForever("{$this->locale}.{$this->entityName}.allFormatted", |
| 36 | - function () { |
|
| 36 | + function() { |
|
| 37 | 37 | return $this->repository->allFormatted(); |
| 38 | 38 | } |
| 39 | 39 | ); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | return $this->cache |
| 52 | 52 | ->tags($this->entityName, 'global') |
| 53 | 53 | ->rememberForever("{$this->locale}.{$this->entityName}.findTranslationByKey.{$key}", |
| 54 | - function () use ($key) { |
|
| 54 | + function() use ($key) { |
|
| 55 | 55 | return $this->repository->findTranslationByKey($key); |
| 56 | 56 | } |
| 57 | 57 | ); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | public function allFormatted() |
| 26 | 26 | { |
| 27 | 27 | $allRows = $this->all(); |
| 28 | - $allDatabaseTranslations = []; |
|
| 28 | + $allDatabaseTranslations = [ ]; |
|
| 29 | 29 | foreach ($allRows as $translation) { |
| 30 | 30 | foreach (config('laravellocalization.supportedLocales') as $locale => $language) { |
| 31 | 31 | if ($translation->hasTranslation($locale)) { |
| 32 | - $allDatabaseTranslations[$locale][$translation->key] = $translation->translate($locale)->value; |
|
| 32 | + $allDatabaseTranslations[ $locale ][ $translation->key ] = $translation->translate($locale)->value; |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function findTranslationByKey($key) |
| 48 | 48 | { |
| 49 | - return $this->model->firstOrCreate(['key' => $key]); |
|
| 49 | + return $this->model->firstOrCreate([ 'key' => $key ]); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |