Passed
Pull Request — 2.x (#926)
by Quentin
06:51
created
src/Helpers/i18n_helpers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
      */
17 17
     function getLocales()
18 18
     {
19
-        $locales = collect(config('translatable.locales'))->map(function ($locale, $index) {
20
-            return collect($locale)->map(function ($country) use ($locale, $index) {
19
+        $locales = collect(config('translatable.locales'))->map(function($locale, $index) {
20
+            return collect($locale)->map(function($country) use ($locale, $index) {
21 21
                 return is_numeric($index)
22 22
                     ? $locale
23 23
                     : "$index-$country";
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $manageMultipleLanguages = count(getLocales()) > 1;
44 44
         if ($manageMultipleLanguages && $translate) {
45
-            $allLanguages = Collection::make(getLocales())->map(function ($locale, $index) use ($form_fields) {
45
+            $allLanguages = Collection::make(getLocales())->map(function($locale, $index) use ($form_fields) {
46 46
                 return [
47 47
                     'shortlabel' => strtoupper($locale),
48 48
                     'label' => getLanguageLabelFromLocaleCode($locale),
Please login to merge, or discard this patch.
src/Models/Behaviors/HasTranslation.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         if (method_exists($query->getModel(), 'translations')) {
36 36
             $locale = $locale == null ? app()->getLocale() : $locale;
37 37
 
38
-            $query->whereHas('translations', function ($query) use ($locale) {
38
+            $query->whereHas('translations', function($query) use ($locale) {
39 39
                 $query->whereActive(true);
40 40
                 $query->whereLocale($locale);
41 41
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                 }
45 45
             });
46 46
 
47
-            return $query->with(['translations' => function ($query) use ($locale) {
47
+            return $query->with(['translations' => function($query) use ($locale) {
48 48
                 $query->whereActive(true);
49 49
                 $query->whereLocale($locale);
50 50
 
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
         $locale = $locale == null ? app()->getLocale() : $locale;
72 72
 
73 73
         return $query
74
-            ->join($translationTable, function (JoinClause $join) use ($translationTable, $localeKey, $table, $keyName) {
74
+            ->join($translationTable, function(JoinClause $join) use ($translationTable, $localeKey, $table, $keyName) {
75 75
                 $join
76
-                    ->on($translationTable.'.'.$this->getRelationKey(), '=', $table.'.'.$keyName)
77
-                    ->where($translationTable.'.'.$localeKey, $this->locale());
76
+                    ->on($translationTable . '.' . $this->getRelationKey(), '=', $table . '.' . $keyName)
77
+                    ->where($translationTable . '.' . $localeKey, $this->locale());
78 78
             })
79
-            ->where($translationTable.'.'.$this->getLocaleKey(), $locale)
80
-            ->orderBy($translationTable.'.'.$orderField, $orderType)
81
-            ->select($table.'.*')
79
+            ->where($translationTable . '.' . $this->getLocaleKey(), $locale)
80
+            ->orderBy($translationTable . '.' . $orderField, $orderType)
81
+            ->select($table . '.*')
82 82
             ->with('translations');
83 83
     }
84 84
 
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function getActiveLanguages()
132 132
     {
133
-        return $this->translations->map(function ($translation) {
133
+        return $this->translations->map(function($translation) {
134 134
             return [
135 135
                 'shortlabel' => strtoupper($translation->locale),
136 136
                 'label' => getLanguageLabelFromLocaleCode($translation->locale),
137 137
                 'value' => $translation->locale,
138 138
                 'published' => $translation->active ?? false,
139 139
             ];
140
-        })->sortBy(function ($translation) {
140
+        })->sortBy(function($translation) {
141 141
             $localesOrdered = getLocales();
142 142
             return array_search($translation['value'], $localesOrdered);
143 143
         })->values();
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function translatedAttribute($key)
153 153
     {
154
-        return $this->translations->mapWithKeys(function ($translation) use ($key) {
154
+        return $this->translations->mapWithKeys(function($translation) use ($key) {
155 155
             return [$translation->locale => $this->translate($translation->locale)->$key];
156 156
         });
157 157
     }
Please login to merge, or discard this patch.