@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public static function toSelectValues(Collection $collection): Collection |
| 10 | 10 | { |
| 11 | - return $collection->map(function (ProvidesFlatReference $item) { |
|
| 11 | + return $collection->map(function(ProvidesFlatReference $item) { |
|
| 12 | 12 | return [ |
| 13 | 13 | 'id' => $item->flatReference()->get(), |
| 14 | 14 | 'label' => $item->flatReferenceLabel(), |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | $grouped = []; |
| 23 | 23 | |
| 24 | - static::toSelectValues($collection)->each(function ($item) use (&$grouped) { |
|
| 24 | + static::toSelectValues($collection)->each(function($item) use (&$grouped) { |
|
| 25 | 25 | if (isset($grouped[$item['group']])) { |
| 26 | 26 | $grouped[$item['group']]['values'][] = $item; |
| 27 | - } else { |
|
| 27 | + }else { |
|
| 28 | 28 | $grouped[$item['group']] = ['group' => $item['group'], 'values' => [$item]]; |
| 29 | 29 | } |
| 30 | 30 | }); |
@@ -21,16 +21,16 @@ |
||
| 21 | 21 | $referenceStrings = []; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - return (new Collection($referenceStrings))->reject(function ($referenceString) { |
|
| 24 | + return (new Collection($referenceStrings))->reject(function($referenceString) { |
|
| 25 | 25 | return is_null($referenceString); |
| 26 | - })->map(function ($referenceString) { |
|
| 26 | + })->map(function($referenceString) { |
|
| 27 | 27 | return FlatReferenceFactory::fromString($referenceString)->instance(); |
| 28 | 28 | }); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function toFlatReferences(): Collection |
| 32 | 32 | { |
| 33 | - return (new Collection($this->all()))->map(function (ProvidesFlatReference $item) { |
|
| 33 | + return (new Collection($this->all()))->map(function(ProvidesFlatReference $item) { |
|
| 34 | 34 | return $item->flatReference()->get(); |
| 35 | 35 | }); |
| 36 | 36 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function apply($value = null): Closure |
| 21 | 21 | { |
| 22 | - return function ($query) use ($value) { |
|
| 22 | + return function($query) use ($value) { |
|
| 23 | 23 | if ($value == 'all') { |
| 24 | 24 | return $query; |
| 25 | 25 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public static function rolesForSelect($includeDeveloperRole = false) |
| 20 | 20 | { |
| 21 | - $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function ($role) { |
|
| 21 | + $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function($role) { |
|
| 22 | 22 | return $role->name == 'developer'; |
| 23 | 23 | }); |
| 24 | 24 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function getPermissionsForIndex() |
| 41 | 41 | { |
| 42 | - $this->permissions->each(function ($permission) { |
|
| 42 | + $this->permissions->each(function($permission) { |
|
| 43 | 43 | $model = explode("_", $permission->name, 2)[1]; |
| 44 | 44 | $temp = $this->permission; |
| 45 | 45 | $temp[$model][] = explode("_", $permission->name, 2)[0]; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function apply($value = null): Closure |
| 17 | 17 | { |
| 18 | - return $this->query && $this->query instanceof Closure ? $this->query : function ($query) { |
|
| 18 | + return $this->query && $this->query instanceof Closure ? $this->query : function($query) { |
|
| 19 | 19 | return $query; |
| 20 | 20 | }; |
| 21 | 21 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function register() |
| 15 | 15 | { |
| 16 | - $this->app->singleton(Settings::class, function ($app) { |
|
| 16 | + $this->app->singleton(Settings::class, function($app) { |
|
| 17 | 17 | return new Settings(); |
| 18 | 18 | }); |
| 19 | 19 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | { |
| 54 | 54 | foreach ($flatReferences as $locale => $flatReferenceString) { |
| 55 | 55 | if (!$flatReferenceString) { |
| 56 | - throw new \InvalidArgumentException('Homepage setting value cannot be empty. Value for locale ' . $locale . ' is missing.'); |
|
| 56 | + throw new \InvalidArgumentException('Homepage setting value cannot be empty. Value for locale '.$locale.' is missing.'); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug. |
| 23 | 23 | $module->update([ |
| 24 | - 'slug' => $module->slug . $this->appendDeleteMarker(), |
|
| 24 | + 'slug' => $module->slug.$this->appendDeleteMarker(), |
|
| 25 | 25 | ]); |
| 26 | 26 | |
| 27 | 27 | $module->delete(); |
@@ -35,6 +35,6 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | private function appendDeleteMarker(): string |
| 37 | 37 | { |
| 38 | - return '_DELETED_' . time(); |
|
| 38 | + return '_DELETED_'.time(); |
|
| 39 | 39 | } |
| 40 | 40 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | private function saveRecord(string $locale, ?string $slug) |
| 58 | 58 | { |
| 59 | 59 | // Existing ones for this locale? |
| 60 | - $nonRedirectsWithSameLocale = $this->existingRecords->filter(function ($record) use ($locale) { |
|
| 60 | + $nonRedirectsWithSameLocale = $this->existingRecords->filter(function($record) use ($locale) { |
|
| 61 | 61 | return ( |
| 62 | 62 | $record->locale == $locale && |
| 63 | 63 | !$record->isRedirect() |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | // If slug entry is left empty, all existing records will be deleted |
| 68 | 68 | if (!$slug) { |
| 69 | - $nonRedirectsWithSameLocale->each(function ($existingRecord) { |
|
| 69 | + $nonRedirectsWithSameLocale->each(function($existingRecord) { |
|
| 70 | 70 | $existingRecord->delete(); |
| 71 | 71 | }); |
| 72 | 72 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Only replace the existing records that differ from the current passed slugs |
| 85 | - $nonRedirectsWithSameLocale->each(function ($existingRecord) use ($slug) { |
|
| 85 | + $nonRedirectsWithSameLocale->each(function($existingRecord) use ($slug) { |
|
| 86 | 86 | if ($existingRecord->slug != $slug) { |
| 87 | 87 | $existingRecord->replaceAndRedirect(['slug' => $slug]); |
| 88 | 88 | } |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | private function deleteIdenticalRedirects($existingRecords, $locale, $slug): void |
| 129 | 129 | { |
| 130 | - $existingRecords->filter(function ($record) use ($locale) { |
|
| 130 | + $existingRecords->filter(function($record) use ($locale) { |
|
| 131 | 131 | return ( |
| 132 | 132 | $record->locale == $locale && |
| 133 | 133 | $record->isRedirect() |
| 134 | 134 | ); |
| 135 | - })->each(function ($existingRecord) use ($slug) { |
|
| 135 | + })->each(function($existingRecord) use ($slug) { |
|
| 136 | 136 | if ($existingRecord->slug == $slug) { |
| 137 | 137 | $existingRecord->delete(); |
| 138 | 138 | } |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | // The old homepage url should be removed since this is no longer in effect. |
| 149 | 149 | // In case of any redirect to this old homepage, the last used redirect is now back in effect. |
| 150 | - $existingRecords->reject(function ($existingRecord) { |
|
| 150 | + $existingRecords->reject(function($existingRecord) { |
|
| 151 | 151 | return ( |
| 152 | 152 | $existingRecord->model_type == $this->model->getMorphClass() && |
| 153 | 153 | $existingRecord->model_id == $this->model->id); |
| 154 | - })->each(function ($existingRecord) { |
|
| 154 | + })->each(function($existingRecord) { |
|
| 155 | 155 | |
| 156 | 156 | // TODO: if there is a redirect to this page, we'll take this one as the new url |
| 157 | 157 | $existingRecord->delete(); |