@@ -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()), |
@@ -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 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | if (!empty($class)) { |
| 28 | 28 | $model = new $class; |
| 29 | - return $model instanceof ContentfulModel?$model:null; |
|
| 29 | + return $model instanceof ContentfulModel ? $model : null; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | return null; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | foreach (config($key, []) as $namespace) { |
| 56 | 56 | $modelClass = rtrim($namespace, |
| 57 | - '\\') . '\\' . ltrim(studly_case($element), '\\'); |
|
| 57 | + '\\').'\\'.ltrim(studly_case($element), '\\'); |
|
| 58 | 58 | |
| 59 | 59 | if (class_exists($modelClass)) { |
| 60 | 60 | return $modelClass; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | if (is_array($value)) { |
| 134 | 134 | if ($this->isLink($value)) { |
| 135 | 135 | try { |
| 136 | - $relationships[] = $this->relationshipSignature($value,$field); |
|
| 136 | + $relationships[] = $this->relationshipSignature($value, $field); |
|
| 137 | 137 | } catch (Exception $e) { |
| 138 | 138 | // |
| 139 | 139 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | foreach ($value as $entry) { |
| 142 | 142 | if ($this->isLink($entry)) { |
| 143 | 143 | try { |
| 144 | - $relationships[] = $this->relationshipSignature($entry,$field); |
|
| 144 | + $relationships[] = $this->relationshipSignature($entry, $field); |
|
| 145 | 145 | } catch (Exception $e) { |
| 146 | 146 | // |
| 147 | 147 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @return array|null |
| 162 | 162 | * @throws \Exception |
| 163 | 163 | */ |
| 164 | - private function relationshipSignature(array $localeField,string $field=''): ?array |
|
| 164 | + private function relationshipSignature(array $localeField, string $field = ''): ?array |
|
| 165 | 165 | { |
| 166 | 166 | if ($localeField['sys']['linkType'] === 'Asset') { |
| 167 | 167 | return [ |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - throw new Exception('Invalid field signature... ' . PHP_EOL . print_r($localeField, true)); |
|
| 182 | + throw new Exception('Invalid field signature... '.PHP_EOL.print_r($localeField, true)); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | return $entry['sys']['contentType']['sys']['id']; |
| 222 | 222 | } |
| 223 | 223 | } catch (Exception $e) { |
| 224 | - throw new Exception('Unknown content-type from synced entry: ' . $contentfulId); |
|
| 224 | + throw new Exception('Unknown content-type from synced entry: '.$contentfulId); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |