Completed
Push — master ( 0fdcfc...2205c9 )
by Mike
03:47
created
src/Translatable.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@  discard block
 block discarded – undo
18 18
 	{
19 19
 		static::addGlobalScope(new TranslatableScope);
20 20
 		
21
-		static::saving(function ($model) {
21
+		static::saving(function($model) {
22 22
 			$model->translatable = collect($model->attributes)->only(static::$transtableFieldName)->toArray();
23 23
 			$model->attributes = collect($model->attributes)->except(static::$transtableFieldName)->toArray();
24 24
 		});
25 25
 		
26
-		static::saved(function ($model) {
26
+		static::saved(function($model) {
27 27
 			if ($model->translatable) {
28 28
 				(new self)->saveTranslation($model);
29 29
 			}
30 30
 		});
31 31
 		
32
-		static::deleted(function ($model) {
32
+		static::deleted(function($model) {
33 33
 			if ((new $model)->has('translations')) {
34 34
 				$model->translations()->delete();
35 35
 			}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		}
67 67
 		
68 68
 		// Build the sub select
69
-		$fields->each(function ($key) use ($query) {
69
+		$fields->each(function($key) use ($query) {
70 70
 			$this->subSelectTranslation($query, $key);
71 71
 		});
72 72
 		
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 	protected function subSelectTranslation($query, $key): void
77 77
 	{
78 78
 		$query->addSelect(\DB::raw('(
79
-			SELECT      `' . Translation::getTableName() . '`.`value`
80
-			  FROM      `' . Translation::getTableName() . '`
81
-			 WHERE      `' . Translation::getTableName() . '`.`translatable_type` = "' . \get_class($this) . '"
82
-			   AND      `' . Translation::getTableName() . '`.`locale` = "' . $this->locale . '"
83
-			   AND      `' . Translation::getTableName() . '`.`key` = "' . $key . '"
84
-			   AND      `' . Translation::getTableName() . '`.`translatable_id` = `' . $this->getTable() . '`.`' . $this->primaryKey . '`
85
-			) as `' . $key . '`')
79
+			SELECT      `' . Translation::getTableName().'`.`value`
80
+			  FROM      `' . Translation::getTableName().'`
81
+			 WHERE      `' . Translation::getTableName().'`.`translatable_type` = "'.\get_class($this).'"
82
+			   AND      `' . Translation::getTableName().'`.`locale` = "'.$this->locale.'"
83
+			   AND      `' . Translation::getTableName().'`.`key` = "'.$key.'"
84
+			   AND      `' . Translation::getTableName().'`.`translatable_id` = `'.$this->getTable().'`.`'.$this->primaryKey.'`
85
+			) as `' . $key.'`')
86 86
 		);
87 87
 	}
88 88
 	
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	{
95 95
 		$table = Translation::getTableName();
96 96
 		
97
-		return DB::table($table)->select($table . '.key')
98
-			->where($table . '.translatable_type', \get_class($this))
99
-			->where($table . '.locale', $this->locale)
100
-			->groupBy($table . '.key')
97
+		return DB::table($table)->select($table.'.key')
98
+			->where($table.'.translatable_type', \get_class($this))
99
+			->where($table.'.locale', $this->locale)
100
+			->groupBy($table.'.key')
101 101
 			->pluck('key');
102 102
 	}
103 103
 	
Please login to merge, or discard this patch.
src/TranslatableServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class TranslatableServiceProvider extends ServiceProvider
15 15
 {
16
-<<<<<<< Updated upstream
16
+<< << << < Updated upstream
17 17
     public function boot()
18 18
     {
19 19
         $this->loadMigrationsFrom(__DIR__.'/database/migrations/');
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
             __DIR__.'/config/languages.php' => config_path('languages.php'),
27 27
         ]);
28 28
 
29
-        Collection::macro('for', function ($field, $code) {
29
+        Collection::macro('for', function($field, $code) {
30 30
             return $this->where('key', $field)->where('locale', $code)->pluck('value')->first() ?? $field;
31 31
         });
32 32
     }
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
     public function register()
35 35
     {
36 36
     }
37
-=======
37
+=== === =
38 38
 	public function boot()
39 39
 	{
40
-		$this->loadMigrationsFrom(__DIR__ . '/database/migrations/');
40
+		$this->loadMigrationsFrom(__DIR__.'/database/migrations/');
41 41
 		
42 42
 		$this->publishes([
43
-			__DIR__ . '/database/migrations/' => database_path('migrations')
43
+			__DIR__.'/database/migrations/' => database_path('migrations')
44 44
 		], 'migrations');
45 45
 		
46 46
 		$this->publishes([
47
-			__DIR__ . '/config/languages.php' => config_path('languages.php'),
47
+			__DIR__.'/config/languages.php' => config_path('languages.php'),
48 48
 		], 'config');
49 49
 		
50
-		Collection::macro('for', function ($field, $code) {
50
+		Collection::macro('for', function($field, $code) {
51 51
 			return $this->where('key', $field)->where('locale', $code)->pluck('value')->first() ?? $field;
52 52
 		});
53 53
 	}
@@ -55,5 +55,5 @@  discard block
 block discarded – undo
55 55
 	public function register()
56 56
 	{
57 57
 	}
58
->>>>>>> Stashed changes
58
+>> >> >> > Stashed changes
59 59
 }
Please login to merge, or discard this patch.