@@ -23,7 +23,7 @@ |
||
| 23 | 23 | $country = !empty($country) ? $country : Locale::getAppOrDefaultCountry(); |
| 24 | 24 | |
| 25 | 25 | return $query |
| 26 | - ->whereRaw('LOWER(' . $this->getTable() . '.country) LIKE LOWER("' . $country . '")') |
|
| 27 | - ->whereRaw('LOWER(' . $this->getTable() . '.locale) LIKE LOWER("' . $locale . '")'); |
|
| 26 | + ->whereRaw('LOWER('.$this->getTable().'.country) LIKE LOWER("'.$country.'")') |
|
| 27 | + ->whereRaw('LOWER('.$this->getTable().'.locale) LIKE LOWER("'.$locale.'")'); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | public function apply(Builder $builder, Model $model) |
| 19 | 19 | { |
| 20 | 20 | $builder |
| 21 | - ->whereNotNull($model->getTable() . '.slug') |
|
| 22 | - ->where($model->getTable() . '.slug', '!=', ''); |
|
| 21 | + ->whereNotNull($model->getTable().'.slug') |
|
| 22 | + ->where($model->getTable().'.slug', '!=', ''); |
|
| 23 | 23 | |
| 24 | 24 | $this->extend($builder); |
| 25 | 25 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function extend(Builder $builder) |
| 34 | 34 | { |
| 35 | - $builder->macro('allowNullSlug', function (Builder $builder) { |
|
| 35 | + $builder->macro('allowNullSlug', function(Builder $builder) { |
|
| 36 | 36 | return $builder->withoutGlobalScope($this); |
| 37 | 37 | }); |
| 38 | 38 | } |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | public function apply(Builder $builder, Model $model) |
| 20 | 20 | { |
| 21 | 21 | $builder |
| 22 | - ->where(function ($query) use ($model) { |
|
| 22 | + ->where(function($query) use ($model) { |
|
| 23 | 23 | $query |
| 24 | - ->whereNull($model->getTable() . '.validated_at') |
|
| 25 | - ->orWhere($model->getTable() . '.validated_at','>=',Carbon::now()->format('Y-m-d H:i:s')); |
|
| 24 | + ->whereNull($model->getTable().'.validated_at') |
|
| 25 | + ->orWhere($model->getTable().'.validated_at', '>=', Carbon::now()->format('Y-m-d H:i:s')); |
|
| 26 | 26 | }); |
| 27 | 27 | |
| 28 | 28 | $this->extend($builder); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function extend(Builder $builder) |
| 38 | 38 | { |
| 39 | - $builder->macro('withoutValidated', function (Builder $builder) { |
|
| 39 | + $builder->macro('withoutValidated', function(Builder $builder) { |
|
| 40 | 40 | return $builder->withoutGlobalScope($this); |
| 41 | 41 | }); |
| 42 | 42 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | ->where('is_default', '=', true) |
| 108 | 108 | ->first(); |
| 109 | 109 | |
| 110 | - $default = ! empty($default) ? $default->country : config('contentful.default_country'); |
|
| 110 | + $default = !empty($default) ? $default->country : config('contentful.default_country'); |
|
| 111 | 111 | |
| 112 | 112 | // Cache is cleaned in Console\Commands\SyncLocales (run at least daily) |
| 113 | 113 | Cache::forever('country_default', $default); |
@@ -124,16 +124,16 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public static function fallback(string $code): string |
| 126 | 126 | { |
| 127 | - $fallback = Cache::get('locale_fallback_' . $code); |
|
| 127 | + $fallback = Cache::get('locale_fallback_'.$code); |
|
| 128 | 128 | |
| 129 | 129 | if ($fallback === null) { |
| 130 | 130 | $locale = static::select('fallback_code') |
| 131 | 131 | ->where('code', '=', $code) |
| 132 | 132 | ->first(); |
| 133 | 133 | |
| 134 | - $fallback = (! empty($locale) && ! empty($locale->fallback_code)) ? $locale->fallback_code : ''; |
|
| 134 | + $fallback = (!empty($locale) && !empty($locale->fallback_code)) ? $locale->fallback_code : ''; |
|
| 135 | 135 | |
| 136 | - Cache::put('locale_fallback_' . $code, $fallback, 5); |
|
| 136 | + Cache::put('locale_fallback_'.$code, $fallback, 5); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return $fallback; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public static function canBeSave(string $country, string $locale): bool |
| 150 | 150 | { |
| 151 | - return ! in_array($country . '_' . $locale, static::_getLocalesDisabled()); |
|
| 151 | + return !in_array($country.'_'.$locale, static::_getLocalesDisabled()); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function isEnabled(): bool |
| 172 | 172 | { |
| 173 | - return ! in_array($this->country . '_' . $this->locale, static::_getLocalesDisabled()); |
|
| 173 | + return !in_array($this->country.'_'.$this->locale, static::_getLocalesDisabled()); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | public static function getAcceptedLanguages(Request $request = null) |
| 225 | 225 | { |
| 226 | - $request = ! empty($request) ? $request : request(); |
|
| 226 | + $request = !empty($request) ? $request : request(); |
|
| 227 | 227 | |
| 228 | 228 | $languages = $request->server('HTTP_ACCEPT_LANGUAGE'); |
| 229 | - if (! empty($languages)) { |
|
| 229 | + if (!empty($languages)) { |
|
| 230 | 230 | preg_match_all('/(\W|^)([a-z]{2})([^a-z]|$)/six', $languages, $locales, PREG_PATTERN_ORDER); |
| 231 | 231 | |
| 232 | - if (! empty($locales) && ! empty($locales[2])) { |
|
| 232 | + if (!empty($locales) && !empty($locales[2])) { |
|
| 233 | 233 | return $locales[2]; |
| 234 | 234 | } |
| 235 | 235 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | { |
| 248 | 248 | $country = static::defaultCountry(); |
| 249 | 249 | $locales = static::getAcceptedLanguages($request); |
| 250 | - $locale = ! empty($locales) ? $locales[0] : config('app.fallback_locale'); |
|
| 250 | + $locale = !empty($locales) ? $locales[0] : config('app.fallback_locale'); |
|
| 251 | 251 | |
| 252 | 252 | $localeModel = (new static) |
| 253 | 253 | ->where('country', $country) |
@@ -70,8 +70,8 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | public function getRelatedEntry() |
| 72 | 72 | { |
| 73 | - $localModel = rtrim(config('contentful.namespaces.model'), '\\') . '\\' . ucfirst($this->src_content_type); |
|
| 74 | - if (! class_exists($localModel)) { |
|
| 73 | + $localModel = rtrim(config('contentful.namespaces.model'), '\\').'\\'.ucfirst($this->src_content_type); |
|
| 74 | + if (!class_exists($localModel)) { |
|
| 75 | 75 | return null; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('use_contentful_preview')) { |
|
| 3 | +if (!function_exists('use_contentful_preview')) { |
|
| 4 | 4 | /** |
| 5 | 5 | * Use Contentful preview switch setup. |
| 6 | 6 | * |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | function use_contentful_preview(bool $state = true) |
| 11 | 11 | { |
| 12 | - if (! empty($state)) { |
|
| 12 | + if (!empty($state)) { |
|
| 13 | 13 | config([ |
| 14 | 14 | 'database.default' => 'mysql_preview', |
| 15 | 15 | 'contentful.use_preview' => 1, |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | { |
| 78 | 78 | $indexed = []; |
| 79 | 79 | |
| 80 | - $locale = ! empty($locale) ? $locale : Locale::default(); |
|
| 80 | + $locale = !empty($locale) ? $locale : Locale::default(); |
|
| 81 | 81 | foreach ($data as $field => $value) { |
| 82 | 82 | $indexed[$field][$locale] = $value; |
| 83 | 83 | } |
@@ -42,5 +42,5 @@ |
||
| 42 | 42 | 'replace_host' => 'images.ctfassets.net', |
| 43 | 43 | ], |
| 44 | 44 | |
| 45 | - 'payload_fields_not_fallback' => explode(',',env('CONTENTFUL_PAYLOAD_FIELD_NOT_FALLBACK', '')) |
|
| 45 | + 'payload_fields_not_fallback' => explode(',', env('CONTENTFUL_PAYLOAD_FIELD_NOT_FALLBACK', '')) |
|
| 46 | 46 | ]; |
| 47 | 47 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | public function modelGetter() |
| 11 | 11 | { |
| 12 | - $stubPath = __DIR__ . '/stubs/string.stub'; |
|
| 12 | + $stubPath = __DIR__.'/stubs/string.stub'; |
|
| 13 | 13 | |
| 14 | 14 | return self::getStub($stubPath, [ |
| 15 | 15 | 'field_camel' => studly_case($this->id()), |