@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function register() |
28 | 28 | { |
29 | - $this->app->singleton(TranslationSavingService::class, function () { |
|
29 | + $this->app->singleton(TranslationSavingService::class, function() { |
|
30 | 30 | return new TranslationSavingService(); |
31 | 31 | }); |
32 | 32 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function apply(Builder $builder, Model $model) |
20 | 20 | { |
21 | - $builder->leftJoin($model->getTranslationTable(), function (JoinClause $join) use ($model) { |
|
21 | + $builder->leftJoin($model->getTranslationTable(), function(JoinClause $join) use ($model) { |
|
22 | 22 | $join->on( |
23 | 23 | $model->getTable() . '.' . $model->getKeyName(), |
24 | 24 | $model->getTranslationTable() . '.' . $model->getForeignKey() |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | public static function bootHasTranslations() |
32 | 32 | { |
33 | 33 | if (config('translatable.use_saving_service', true)) { |
34 | - self::saving(function (self $model) { |
|
34 | + self::saving(function(self $model) { |
|
35 | 35 | app(TranslationSavingService::class)->rememberTranslationForModel($model); |
36 | 36 | }); |
37 | 37 | |
38 | - self::saved(function (self $model) { |
|
38 | + self::saved(function(self $model) { |
|
39 | 39 | app(TranslationSavingService::class)->storeTranslationOnModel($model); |
40 | 40 | |
41 | 41 | $model->refreshTranslation(); |
42 | 42 | }); |
43 | 43 | } |
44 | 44 | |
45 | - self::deleting(function (self $model) { |
|
45 | + self::deleting(function(self $model) { |
|
46 | 46 | $model->purgeTranslations(); |
47 | 47 | }); |
48 | 48 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function getTranslatable(): array |
132 | 132 | { |
133 | - if (! isset($this->translatable)) { |
|
133 | + if (!isset($this->translatable)) { |
|
134 | 134 | throw new MissingTranslationsException('Model "' . self::class . '" is missing translations'); |
135 | 135 | } |
136 | 136 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function storeTranslation(string $locale, array $attributes = []) |
156 | 156 | { |
157 | - if (! is_null($model = $this->translations()->where($this->getLocaleKeyName(), $locale)->first())) { |
|
157 | + if (!is_null($model = $this->translations()->where($this->getLocaleKeyName(), $locale)->first())) { |
|
158 | 158 | $model->update($attributes); |
159 | 159 | |
160 | 160 | return $model; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function refreshTranslation() |
234 | 234 | { |
235 | - if (! $this->exists) { |
|
235 | + if (!$this->exists) { |
|
236 | 236 | return null; |
237 | 237 | } |
238 | 238 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function translate(string $locale) |
259 | 259 | { |
260 | - if (! $this->exists) { |
|
260 | + if (!$this->exists) { |
|
261 | 261 | return null; |
262 | 262 | } |
263 | 263 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | { |
276 | 276 | $table = $this->getTranslationTable(); |
277 | 277 | |
278 | - return array_map(function ($item) use ($table) { |
|
278 | + return array_map(function($item) use ($table) { |
|
279 | 279 | return $table . '.' . $item; |
280 | 280 | }, $this->getTranslatable()); |
281 | 281 | } |
@@ -23,12 +23,12 @@ |
||
23 | 23 | |
24 | 24 | protected function setUpDatabase() |
25 | 25 | { |
26 | - Schema::create('test_models', function (Blueprint $table) { |
|
26 | + Schema::create('test_models', function(Blueprint $table) { |
|
27 | 27 | $table->increments('id'); |
28 | 28 | $table->timestamps(); |
29 | 29 | }); |
30 | 30 | |
31 | - Schema::create('test_model_translations', function (Blueprint $table) { |
|
31 | + Schema::create('test_model_translations', function(Blueprint $table) { |
|
32 | 32 | $table->increments('id'); |
33 | 33 | $table->unsignedInteger('test_model_id'); |
34 | 34 | $table->string('locale'); |