@@ -21,8 +21,8 @@ |
||
21 | 21 | { |
22 | 22 | $this->deleteTranslation($attributes['translatable_type'], $attributes['translatable_id']); |
23 | 23 | |
24 | - collect($attributes['translatable'])->each(function ($data, $locale) use ($attributes) { |
|
25 | - collect($data)->each(function ($value, $key) use ($attributes, $locale) { |
|
24 | + collect($attributes['translatable'])->each(function($data, $locale) use ($attributes) { |
|
25 | + collect($data)->each(function($value, $key) use ($attributes, $locale) { |
|
26 | 26 | self::insert([ |
27 | 27 | 'key' => $key, |
28 | 28 | 'value' => $value ?? '', |
@@ -18,18 +18,18 @@ discard block |
||
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 |
||
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 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('translations', function (Blueprint $table) { |
|
16 | + Schema::create('translations', function(Blueprint $table) { |
|
17 | 17 | $table->string('key'); |
18 | 18 | $table->text('value'); |
19 | 19 | $table->bigInteger('translatable_id')->unsigned(); |
@@ -35,25 +35,25 @@ |
||
35 | 35 | { |
36 | 36 | } |
37 | 37 | ======= |
38 | - public function boot() |
|
39 | - { |
|
40 | - $this->loadMigrationsFrom(__DIR__ . '/database/migrations/'); |
|
38 | + public function boot() |
|
39 | + { |
|
40 | + $this->loadMigrationsFrom(__DIR__ . '/database/migrations/'); |
|
41 | 41 | |
42 | - $this->publishes([ |
|
43 | - __DIR__ . '/database/migrations/' => database_path('migrations') |
|
44 | - ], 'migrations'); |
|
42 | + $this->publishes([ |
|
43 | + __DIR__ . '/database/migrations/' => database_path('migrations') |
|
44 | + ], 'migrations'); |
|
45 | 45 | |
46 | - $this->publishes([ |
|
47 | - __DIR__ . '/config/languages.php' => config_path('languages.php'), |
|
48 | - ], 'config'); |
|
46 | + $this->publishes([ |
|
47 | + __DIR__ . '/config/languages.php' => config_path('languages.php'), |
|
48 | + ], 'config'); |
|
49 | 49 | |
50 | - Collection::macro('for', function ($field, $code) { |
|
51 | - return $this->where('key', $field)->where('locale', $code)->pluck('value')->first() ?? $field; |
|
52 | - }); |
|
53 | - } |
|
50 | + Collection::macro('for', function ($field, $code) { |
|
51 | + return $this->where('key', $field)->where('locale', $code)->pluck('value')->first() ?? $field; |
|
52 | + }); |
|
53 | + } |
|
54 | 54 | |
55 | - public function register() |
|
56 | - { |
|
57 | - } |
|
55 | + public function register() |
|
56 | + { |
|
57 | + } |
|
58 | 58 | >>>>>>> Stashed changes |
59 | 59 | } |
@@ -13,7 +13,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
55 | 55 | public function register() |
56 | 56 | { |
57 | 57 | } |
58 | ->>>>>>> Stashed changes |
|
58 | +>> >> >> > Stashed changes |
|
59 | 59 | } |