Passed
Push — 1.2 ( fe888f...e46b23 )
by Quentin
06:10
created
src/Models/Behaviors/HasTranslation.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         if (method_exists($query->getModel(), 'translations')) {
20 20
             $locale = $locale == null ? app()->getLocale() : $locale;
21 21
 
22
-            $query->whereHas('translations', function ($query) use ($locale) {
22
+            $query->whereHas('translations', function($query) use ($locale) {
23 23
                 $query->whereActive(true);
24 24
                 $query->whereLocale($locale);
25 25
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
                 }
29 29
             });
30 30
 
31
-            return $query->with(['translations' => function ($query) use ($locale) {
31
+            return $query->with(['translations' => function($query) use ($locale) {
32 32
                 $query->whereActive(true);
33 33
                 $query->whereLocale($locale);
34 34
 
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
         $locale = $locale == null ? app()->getLocale() : $locale;
49 49
 
50 50
         return $query
51
-            ->join($translationTable, function (JoinClause $join) use ($translationTable, $localeKey, $table, $keyName) {
51
+            ->join($translationTable, function(JoinClause $join) use ($translationTable, $localeKey, $table, $keyName) {
52 52
                 $join
53
-                    ->on($translationTable.'.'.$this->getRelationKey(), '=', $table.'.'.$keyName)
54
-                    ->where($translationTable.'.'.$localeKey, $this->locale());
53
+                    ->on($translationTable . '.' . $this->getRelationKey(), '=', $table . '.' . $keyName)
54
+                    ->where($translationTable . '.' . $localeKey, $this->locale());
55 55
             })
56
-            ->where($translationTable.'.'.$this->getLocaleKey(), $locale)
57
-            ->orderBy($translationTable.'.'.$orderField, $orderType)
58
-            ->select($table.'.*')
56
+            ->where($translationTable . '.' . $this->getLocaleKey(), $locale)
57
+            ->orderBy($translationTable . '.' . $orderField, $orderType)
58
+            ->select($table . '.*')
59 59
             ->with('translations');
60 60
     }
61 61
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function getActiveLanguages()
93 93
     {
94
-        return $this->translations->map(function ($translation) {
94
+        return $this->translations->map(function($translation) {
95 95
             return [
96 96
                 'shortlabel' => strtoupper($translation->locale),
97 97
                 'label' => getLanguageLabelFromLocaleCode($translation->locale),
98 98
                 'value' => $translation->locale,
99 99
                 'published' => $translation->active ?? false,
100 100
             ];
101
-        })->sortBy(function ($translation) {
101
+        })->sortBy(function($translation) {
102 102
             $localesOrdered = config('translatable.locales');
103 103
             return array_search($translation['value'], $localesOrdered);
104 104
         })->values();
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     public function translatedAttribute($key)
108 108
     {
109
-        return $this->translations->mapWithKeys(function ($translation) use ($key) {
109
+        return $this->translations->mapWithKeys(function($translation) use ($key) {
110 110
             return [$translation->locale => $this->translate($translation->locale)->$key];
111 111
         });
112 112
     }
Please login to merge, or discard this patch.