@@ -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 | } |
@@ -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()), |
@@ -132,12 +132,12 @@ |
||
| 132 | 132 | private function fieldsWithFallback(array $fields, string $locale): array |
| 133 | 133 | { |
| 134 | 134 | $fallbackLocale = Locale::fallback($locale); |
| 135 | - $file = $this->getFieldValue($fields, 'file', $locale, $fallbackLocale,[]); |
|
| 135 | + $file = $this->getFieldValue($fields, 'file', $locale, $fallbackLocale, []); |
|
| 136 | 136 | $details = isset($file['details']) ? $file['details'] : []; |
| 137 | 137 | |
| 138 | 138 | return [ |
| 139 | - 'title' => $this->getFieldValue($fields, 'title', $locale, $fallbackLocale,''), |
|
| 140 | - 'description' => $this->getFieldValue($fields, 'description', $locale, $fallbackLocale,''), |
|
| 139 | + 'title' => $this->getFieldValue($fields, 'title', $locale, $fallbackLocale, ''), |
|
| 140 | + 'description' => $this->getFieldValue($fields, 'description', $locale, $fallbackLocale, ''), |
|
| 141 | 141 | 'url' => isset($file['url']) ? $file['url'] : '', |
| 142 | 142 | 'file_name' => isset($file['fileName']) ? $file['fileName'] : '', |
| 143 | 143 | 'content_type' => isset($file['contentType']) ? $file['contentType'] : '', |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | 'fm' => config('contentful.image.use_webp') ? $format : null, |
| 41 | 41 | 'fl' => static::detectProgressive($format, $useProgressive) ? 'progressive' : null, |
| 42 | 42 | 'fit' => static::detectFit($fit), |
| 43 | - ])->filter(function ($value) { |
|
| 43 | + ])->filter(function($value) { |
|
| 44 | 44 | return !empty($value); |
| 45 | - })->each(function ($value, $key) use (& $imageUrl) { |
|
| 46 | - $imageUrl .= $key . '=' . $value . '&'; |
|
| 45 | + })->each(function($value, $key) use (& $imageUrl) { |
|
| 46 | + $imageUrl .= $key.'='.$value.'&'; |
|
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | 49 | return static::replaceHosts($url, $imageUrl); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $url = str_replace(explode(',', $searchHosts), $replaceHost, $url); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - return !empty($url) ? $url . '?' . trim($imageUrl, '&') : ''; |
|
| 70 | + return !empty($url) ? $url.'?'.trim($imageUrl, '&') : ''; |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |