@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | public function onlyModules(): Collection |
36 | 36 | { |
37 | - return $this->collection()->reject(function ($item) { |
|
37 | + return $this->collection()->reject(function($item) { |
|
38 | 38 | return ($item instanceof ActsAsParent); |
39 | 39 | }); |
40 | 40 | } |
41 | 41 | |
42 | 42 | public function onlyPages(): Collection |
43 | 43 | { |
44 | - return $this->collection()->filter(function ($item) { |
|
44 | + return $this->collection()->filter(function($item) { |
|
45 | 45 | return ($item instanceof ActsAsParent); |
46 | 46 | }); |
47 | 47 | } |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | // } |
97 | 97 | |
98 | 98 | // Remove duplicate models |
99 | - $collection = $collection->unique(function ($model) { |
|
99 | + $collection = $collection->unique(function($model) { |
|
100 | 100 | return (new ModelReference(get_class($model), $model->id))->get(); |
101 | 101 | }); |
102 | 102 | |
103 | 103 | // Filter out our parent |
104 | - return $this->collection = $collection->reject(function ($item) { |
|
104 | + return $this->collection = $collection->reject(function($item) { |
|
105 | 105 | return ($item instanceof $this->parent && $item->id == $this->parent->id); |
106 | 106 | })->values(); |
107 | 107 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $models = UrlRecord::allOnlineModels($locale); |
77 | 77 | |
78 | 78 | $this->urls = $models |
79 | - ->reject(function (ProvidesUrl $model) use ($locale) { |
|
79 | + ->reject(function(ProvidesUrl $model) use ($locale) { |
|
80 | 80 | // In case the url is not found or present for given locale. |
81 | 81 | return !$model->url($locale); |
82 | 82 | }) |
83 | - ->map(function (ProvidesUrl $model) use ($locale, $alternateLocales) { |
|
83 | + ->map(function(ProvidesUrl $model) use ($locale, $alternateLocales) { |
|
84 | 84 | $url = $model->url($locale); |
85 | 85 | |
86 | 86 | $alternateUrls = []; |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | { |
102 | 102 | $pool = new Pool($this->httpClient, $this->crawlableUrlGenerator(), [ |
103 | 103 | 'concurrency' => 5, |
104 | - 'fulfilled' => function (Response $response, $index) { |
|
104 | + 'fulfilled' => function(Response $response, $index) { |
|
105 | 105 | if ($response->getStatusCode() !== \Symfony\Component\HttpFoundation\Response::HTTP_OK) { |
106 | 106 | unset($this->urls[$index]); |
107 | 107 | } |
108 | 108 | }, |
109 | - 'rejected' => function (RequestException $reason, $index) { |
|
109 | + 'rejected' => function(RequestException $reason, $index) { |
|
110 | 110 | unset($this->urls[$index]); |
111 | 111 | }, |
112 | 112 | ]); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $files = $this->filesystem->files($directory); |
30 | 30 | |
31 | - return collect($files)->filter(function ($file) { |
|
31 | + return collect($files)->filter(function($file) { |
|
32 | 32 | return (Str::startsWith($file->getFileName(), 'sitemap-') && Str::endsWith($file->getFileName(), '.xml')); |
33 | 33 | }); |
34 | 34 | } |
@@ -18,11 +18,11 @@ |
||
18 | 18 | $urlRecord = UrlRecord::find($id); |
19 | 19 | |
20 | 20 | if (!$urlRecord) { |
21 | - return response()->json(['No url record found by id ' . $id], 500); |
|
21 | + return response()->json(['No url record found by id '.$id], 500); |
|
22 | 22 | } |
23 | 23 | |
24 | - if (! $urlRecord->isRedirect()) { |
|
25 | - return response()->json(['Url with id ' . $id . ' is not a redirect'], 500); |
|
24 | + if (!$urlRecord->isRedirect()) { |
|
25 | + return response()->json(['Url with id '.$id.' is not a redirect'], 500); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $this->pointChildRedirectsToParent($urlRecord, $urlRecord->redirect_id); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function check(Request $request) |
17 | 17 | { |
18 | 18 | /** @var ProvidesUrl|Model $model */ |
19 | - $model = (new ModelReference($request->modelClass, (int) $request->modelId))->instance(); |
|
19 | + $model = (new ModelReference($request->modelClass, (int)$request->modelId))->instance(); |
|
20 | 20 | |
21 | 21 | // Trim slashes if any |
22 | 22 | $slug = ($request->slug !== '/') ? trim($request->slug, '/') : $request->slug; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if ($urlRecord->isRedirect()) { |
41 | 41 | return 'Deze link bestaat reeds als redirect. Deze redirect zal bijgevolg worden verwijderd.'; |
42 | 42 | } |
43 | - return 'Deze link bestaat reeds. Kies een andere of <a target="_blank" href="' . $this->editRouteOfOtherModel($urlRecord) . '">pas de andere pagina aan</a>.'; |
|
43 | + return 'Deze link bestaat reeds. Kies een andere of <a target="_blank" href="'.$this->editRouteOfOtherModel($urlRecord).'">pas de andere pagina aan</a>.'; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | private function editRouteOfOtherModel(UrlRecord $urlRecord): string |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ->first(); |
37 | 37 | |
38 | 38 | if (!$record) { |
39 | - throw new UrlRecordNotFound('No url record found for model [' . $model->getMorphClass() . '@' . $model->id . '] for locale [' . $locale . '].'); |
|
39 | + throw new UrlRecordNotFound('No url record found for model ['.$model->getMorphClass().'@'.$model->id.'] for locale ['.$locale.'].'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $record; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public static function getByModel(Model $model) |
46 | 46 | { |
47 | - return chiefMemoize('url-records-get-by-model', function ($model) { |
|
47 | + return chiefMemoize('url-records-get-by-model', function($model) { |
|
48 | 48 | return parent::getByModel($model); |
49 | 49 | }, [$model]); |
50 | 50 | } |
@@ -18,14 +18,14 @@ 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 | |
25 | 25 | $fields = new static([]); |
26 | 26 | |
27 | 27 | foreach ($records as $record) { |
28 | - $key = 'redirects-' . $record->locale . '-' . $record->slug; |
|
28 | + $key = 'redirects-'.$record->locale.'-'.$record->slug; |
|
29 | 29 | $fields[$key] = UrlSlugField::make($key) |
30 | 30 | ->setUrlRecord($record) |
31 | 31 | ->setFullUrl($model->resolveUrl($record->locale, $record->slug)); |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | $fields = new static([]); |
61 | 61 | |
62 | 62 | foreach ($locales as $locale) { |
63 | - $fields['url-slugs.' . $locale] = UrlSlugField::make('url-slugs.' . $locale) |
|
63 | + $fields['url-slugs.'.$locale] = UrlSlugField::make('url-slugs.'.$locale) |
|
64 | 64 | ->setBaseUrlSegment($model->baseUrlSegment($locale)) |
65 | - ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)) . '/') |
|
66 | - ->name('url-slugs[' . $locale . ']') |
|
65 | + ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)).'/') |
|
66 | + ->name('url-slugs['.$locale.']') |
|
67 | 67 | ->label($locale); |
68 | 68 | } |
69 | 69 | |
@@ -76,19 +76,19 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private static function fillWithExistingValues(ProvidesUrl $model, self $fields): void |
78 | 78 | { |
79 | - $records = UrlRecord::getByModel($model)->reject(function ($record) { |
|
79 | + $records = UrlRecord::getByModel($model)->reject(function($record) { |
|
80 | 80 | return $record->isRedirect(); |
81 | 81 | })->sortBy('locale'); |
82 | 82 | |
83 | 83 | foreach ($records as $record) { |
84 | - if (!isset($fields['url-slugs.' . $record->locale])) { |
|
84 | + if (!isset($fields['url-slugs.'.$record->locale])) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | |
88 | - $fields['url-slugs.' . $record->locale] |
|
88 | + $fields['url-slugs.'.$record->locale] |
|
89 | 89 | ->setUrlRecord($record) |
90 | 90 | ->setBaseUrlSegment($model->baseUrlSegment($record->locale)) |
91 | - ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) . '/'); |
|
91 | + ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Thinktomorrow\Chief\Site\Urls\Field; |
6 | 6 | |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | // Push update to homepage setting value |
21 | 21 | // TODO: we should just fetch the homepages and push that instead... |
22 | - UrlRecord::getByModel($model)->reject(function ($record) { |
|
22 | + UrlRecord::getByModel($model)->reject(function($record) { |
|
23 | 23 | return ($record->isRedirect() || !$record->isHomepage()); |
24 | - })->each(function ($record) { |
|
24 | + })->each(function($record) { |
|
25 | 25 | app(ChangeHomepage::class)->onUrlChanged($record); |
26 | 26 | }); |
27 | 27 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | return $this->fullUrl |
44 | 44 | ? $this->fullUrl |
45 | - : $this->prepend . $this->getValue(); |
|
45 | + : $this->prepend.$this->getValue(); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function setFullUrl(string $fullUrl) |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | 'baseUrlSegment' => $this->baseUrlSegment, |
95 | 95 | 'hint' => null, // Hint placeholder to show url hint when it already exists |
96 | 96 | 'is_homepage' => ($this->getValue() === '/'), |
97 | - 'show' => !!$this->getValue(),// show input field or not |
|
97 | + 'show' => !!$this->getValue(), // show input field or not |
|
98 | 98 | ]; |
99 | 99 | } |
100 | 100 | } |