@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | $this->filters()->apply($builder); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if($this->isAssistedBy('publish')) { |
|
| 75 | - $builder->orderBy('published','DESC'); |
|
| 74 | + if ($this->isAssistedBy('publish')) { |
|
| 75 | + $builder->orderBy('published', 'DESC'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $builder->orderBy('updated_at','DESC'); |
|
| 78 | + $builder->orderBy('updated_at', 'DESC'); |
|
| 79 | 79 | |
| 80 | - return $builder->get()->map(function ($model) { |
|
| 80 | + return $builder->get()->map(function($model) { |
|
| 81 | 81 | return (new static($this->registration))->manage($model); |
| 82 | 82 | }); |
| 83 | 83 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | public function guard($verb): Manager |
| 147 | 147 | { |
| 148 | - if (! $this->can($verb)) { |
|
| 148 | + if (!$this->can($verb)) { |
|
| 149 | 149 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $fields = $this->fields(); |
| 169 | 169 | |
| 170 | 170 | foreach ($this->assistants() as $assistant) { |
| 171 | - if (! method_exists($assistant, 'fields')) { |
|
| 171 | + if (!method_exists($assistant, 'fields')) { |
|
| 172 | 172 | continue; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | // prepend the name with the expected trans.<locale>. string |
| 28 | 28 | $localizedAttr = (false !== strpos($attr, ':locale')) |
| 29 | 29 | ? str_replace(':locale', $locale, $attr) |
| 30 | - : 'trans.' . $locale . '.' . $attr; |
|
| 30 | + : 'trans.'.$locale.'.'.$attr; |
|
| 31 | 31 | |
| 32 | 32 | $localizedAttr = $this->replaceBracketsByDots($localizedAttr); |
| 33 | 33 | |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function influenceByPayload(array $data) |
| 51 | 51 | { |
| 52 | - if (! isset($data['trans'])) { |
|
| 52 | + if (!isset($data['trans'])) { |
|
| 53 | 53 | return $this; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Remove locales that are considered empty in the request payload |
| 57 | 57 | foreach ($data['trans'] as $locale => $values) { |
| 58 | - if ($locale == $this->defaultLocale || ! is_array_empty($values)) { |
|
| 58 | + if ($locale == $this->defaultLocale || !is_array_empty($values)) { |
|
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ->where('model_id', $model->id) |
| 76 | 76 | ->where('locale', $locale) |
| 77 | 77 | ->where('redirect_id', '<>', null) |
| 78 | - ->orderBy('updated_at','DESC') |
|
| 78 | + ->orderBy('updated_at', 'DESC') |
|
| 79 | 79 | ->first(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -145,12 +145,12 @@ discard block |
||
| 145 | 145 | $builder->where('locale', $locale); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if (! $includeRedirects) { |
|
| 148 | + if (!$includeRedirects) { |
|
| 149 | 149 | $builder->whereNull('redirect_id'); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if ($ignoredModel) { |
| 153 | - $builder->whereNotIn('id', function ($query) use ($ignoredModel) { |
|
| 153 | + $builder->whereNotIn('id', function($query) use ($ignoredModel) { |
|
| 154 | 154 | $query->select('id') |
| 155 | 155 | ->from('chief_urls') |
| 156 | 156 | ->where('model_type', '=', $ignoredModel->getMorphClass()) |
@@ -15,21 +15,21 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public static function allOnlineModels(bool $onlySingles = false): array |
| 17 | 17 | { |
| 18 | - return chiefMemoize('all-online-models', function () use ($onlySingles) { |
|
| 18 | + return chiefMemoize('all-online-models', function() use ($onlySingles) { |
|
| 19 | 19 | $builder = UrlRecord::whereNull('redirect_id')->select('model_type', 'model_id')->groupBy('model_type', 'model_id'); |
| 20 | 20 | |
| 21 | 21 | if ($onlySingles) { |
| 22 | 22 | $builder->where('model_type', 'singles'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - $liveUrlRecords = $builder->get()->mapToGroups(function ($record) { |
|
| 25 | + $liveUrlRecords = $builder->get()->mapToGroups(function($record) { |
|
| 26 | 26 | return [$record->model_type => $record->model_id]; |
| 27 | 27 | }); |
| 28 | 28 | |
| 29 | 29 | // Get model for each of these records... |
| 30 | - $models = $liveUrlRecords->map(function ($record, $key) { |
|
| 30 | + $models = $liveUrlRecords->map(function($record, $key) { |
|
| 31 | 31 | return Morphables::instance($key)->find($record->toArray()); |
| 32 | - })->map->reject(function ($model) { |
|
| 32 | + })->map->reject(function($model) { |
|
| 33 | 33 | // Invalid references to archived or removed models where url record still exists. |
| 34 | 34 | return is_null($model) || !$model->isPublished(); |
| 35 | 35 | })->flatten(); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public static function redirectsFromModel(ProvidesUrl $model) |
| 20 | 20 | { |
| 21 | - $records = MemoizedUrlRecord::getByModel($model)->reject(function ($record) { |
|
| 21 | + $records = MemoizedUrlRecord::getByModel($model)->reject(function($record) { |
|
| 22 | 22 | return !$record->isRedirect(); |
| 23 | 23 | })->sortByDesc('created_at'); |
| 24 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $fields[$key] = UrlSlugField::make($key) |
| 30 | 30 | ->setUrlRecord($record) |
| 31 | 31 | ->setBaseUrlSegment($model->baseUrlSegment($record->locale)) |
| 32 | - ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) . ($record->slug != '/' ? '/' : '')); |
|
| 32 | + ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).($record->slug != '/' ? '/' : '')); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | return $fields; |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | $fields = new static([]); |
| 62 | 62 | |
| 63 | 63 | foreach ($locales as $locale) { |
| 64 | - $fields['url-slugs.' . $locale] = UrlSlugField::make('url-slugs.' . $locale) |
|
| 64 | + $fields['url-slugs.'.$locale] = UrlSlugField::make('url-slugs.'.$locale) |
|
| 65 | 65 | ->setBaseUrlSegment($model->baseUrlSegment($locale)) |
| 66 | - ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)) .'/') |
|
| 67 | - ->name('url-slugs[' . $locale . ']') |
|
| 66 | + ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)).'/') |
|
| 67 | + ->name('url-slugs['.$locale.']') |
|
| 68 | 68 | ->label($locale); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | private static function fillWithExistingValues(ProvidesUrl $model, self $fields): void |
| 79 | 79 | { |
| 80 | - $records = UrlRecord::getByModel($model)->reject(function ($record) { |
|
| 80 | + $records = UrlRecord::getByModel($model)->reject(function($record) { |
|
| 81 | 81 | return $record->isRedirect(); |
| 82 | 82 | })->sortBy('locale'); |
| 83 | 83 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $fields['url-slugs.'.$record->locale] |
| 90 | 90 | ->setUrlRecord($record) |
| 91 | 91 | ->setBaseUrlSegment($model->baseUrlSegment($record->locale)) |
| 92 | - ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) .'/'); |
|
| 92 | + ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/'); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |