@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public static function modelsByType(array $types, Model $ignoredModel = null, bool $online = true) |
| 91 | 91 | { |
| 92 | - $models = chiefMemoize('all-online-models-' . implode('_', $types), function () use ($types, $online) { |
|
| 92 | + $models = chiefMemoize('all-online-models-'.implode('_', $types), function() use ($types, $online) { |
|
| 93 | 93 | $builder = UrlRecord::whereNull('redirect_id') |
| 94 | 94 | ->select('model_type', 'model_id') |
| 95 | 95 | ->groupBy('model_type', 'model_id'); |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | $builder->whereIn('model_type', $types); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - return $builder->get()->mapToGroups(function ($record) { |
|
| 101 | + return $builder->get()->mapToGroups(function($record) { |
|
| 102 | 102 | return [$record->model_type => $record->model_id]; |
| 103 | - })->map(function ($record, $key) { |
|
| 103 | + })->map(function($record, $key) { |
|
| 104 | 104 | return Morphables::instance($key)->find($record->toArray()); |
| 105 | - })->map->reject(function ($model) use ($online) { |
|
| 105 | + })->map->reject(function($model) use ($online) { |
|
| 106 | 106 | if ($online) { |
| 107 | 107 | return is_null($model) || (public_method_exists($model, 'isPublished') && !$model->isPublished()); |
| 108 | 108 | } // Invalid references to archived or removed models where url record still exists. |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | }); |
| 113 | 113 | |
| 114 | 114 | if ($ignoredModel) { |
| 115 | - $models = $models->reject(function ($model) use ($ignoredModel) { |
|
| 115 | + $models = $models->reject(function($model) use ($ignoredModel) { |
|
| 116 | 116 | return (get_class($model) === get_class($ignoredModel) && $model->id === $ignoredModel->id); |
| 117 | 117 | }); |
| 118 | 118 | } |
@@ -23,15 +23,15 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | foreach ($rules as $key => $rule) { |
| 26 | - $translationrules['trans.' . $locale . '.' . $key] = $rule; |
|
| 26 | + $translationrules['trans.'.$locale.'.'.$key] = $rule; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | foreach ($attributes as $key => $attribute) { |
| 30 | - $translationattributes['trans.' . $locale . '.' . $key] = $attribute; |
|
| 30 | + $translationattributes['trans.'.$locale.'.'.$key] = $attribute; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | foreach ($messages as $key => $message) { |
| 34 | - $translationmessages['trans.' . $locale . '.' . $key] = $message; |
|
| 34 | + $translationmessages['trans.'.$locale.'.'.$key] = $message; |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $available_locales = static::availableLocales(); |
| 147 | 147 | $current_locales = $this->translations->pluck('locale')->toArray(); |
| 148 | 148 | |
| 149 | - return array_filter($available_locales, function ($v) use ($current_locales, $available) { |
|
| 149 | + return array_filter($available_locales, function($v) use ($current_locales, $available) { |
|
| 150 | 150 | return $available ? in_array($v, $current_locales) : !in_array($v, $current_locales); |
| 151 | 151 | }, ARRAY_FILTER_USE_BOTH); |
| 152 | 152 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | private function validateLocale($locale) |
| 160 | 160 | { |
| 161 | 161 | if (!in_array($locale, static::availableLocales())) { |
| 162 | - throw new InvalidArgumentException('Locale [' . $locale . '] is not available'); |
|
| 162 | + throw new InvalidArgumentException('Locale ['.$locale.'] is not available'); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -34,22 +34,22 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function get(): string |
| 36 | 36 | { |
| 37 | - $basePath = $this->viewBasePath ? $this->viewBasePath . '.' : ''; |
|
| 37 | + $basePath = $this->viewBasePath ? $this->viewBasePath.'.' : ''; |
|
| 38 | 38 | $guessedParentViewName = $this->parent ? $this->parent->viewKey() : ''; |
| 39 | 39 | $guessedViewName = $this->viewable->viewKey(); |
| 40 | 40 | |
| 41 | 41 | $viewPaths = [ |
| 42 | - $basePath . $guessedParentViewName . '.' . $guessedViewName, |
|
| 43 | - $basePath . $guessedViewName, |
|
| 44 | - $basePath . $guessedViewName . '.show', |
|
| 45 | - $basePath . 'show', |
|
| 42 | + $basePath.$guessedParentViewName.'.'.$guessedViewName, |
|
| 43 | + $basePath.$guessedViewName, |
|
| 44 | + $basePath.$guessedViewName.'.show', |
|
| 45 | + $basePath.'show', |
|
| 46 | 46 | ]; |
| 47 | 47 | |
| 48 | 48 | // In case the collection set is made out of pages, we'll also allow to use the |
| 49 | 49 | // generic collection page view for these sets as well as a fallback view |
| 50 | 50 | if ($this->viewable instanceof Set && $this->viewable->first() instanceof ViewableContract) { |
| 51 | - $viewPaths[] = $basePath . $guessedParentViewName . '.' . $this->viewable->first()->viewKey(); |
|
| 52 | - $viewPaths[] = $basePath . $this->viewable->first()->viewKey(); |
|
| 51 | + $viewPaths[] = $basePath.$guessedParentViewName.'.'.$this->viewable->first()->viewKey(); |
|
| 52 | + $viewPaths[] = $basePath.$this->viewable->first()->viewKey(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | foreach ($viewPaths as $viewPath) { |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | return $viewPath; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if (!view()->exists($basePath . 'show')) { |
|
| 64 | - throw new NotFoundView('Viewfile not found for [' . get_class($this->viewable) . ']. Make sure the view [' . $basePath . $guessedViewName . '] or the default view [' . $basePath . 'show] exists.'); |
|
| 63 | + if (!view()->exists($basePath.'show')) { |
|
| 64 | + throw new NotFoundView('Viewfile not found for ['.get_class($this->viewable).']. Make sure the view ['.$basePath.$guessedViewName.'] or the default view ['.$basePath.'show] exists.'); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public static function reorderAgainstSiblings(array $sequence) |
| 21 | 21 | { |
| 22 | - array_walk($sequence, function ($id, $i) { |
|
| 22 | + array_walk($sequence, function($id, $i) { |
|
| 23 | 23 | self::findOrFail($id)->reorder($i); |
| 24 | 24 | }); |
| 25 | 25 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if (!class_exists($class)) { |
| 19 | - throw new NotFoundMorphKey('No class found by morphkey [' . $class . ']. Make sure that the morphkey is a valid class reference.'); |
|
| 19 | + throw new NotFoundMorphKey('No class found by morphkey ['.$class.']. Make sure that the morphkey is a valid class reference.'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | return new $class($attributes); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | private function convertToMorphInstance(Model $model, string $morphKey): Model |
| 46 | 46 | { |
| 47 | 47 | // Here we load up the proper collection model instead of the generic base class. |
| 48 | - return tap(Morphables::instance($morphKey, $model->attributes), function ($instance) use ($model) { |
|
| 48 | + return tap(Morphables::instance($morphKey, $model->attributes), function($instance) use ($model) { |
|
| 49 | 49 | $instance->setRawAttributes($model->attributes); |
| 50 | 50 | $instance->setRelations($model->relations); |
| 51 | 51 | $instance->exists = $model->exists; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | if ($this->requiresCustomTranslation($instance)) { |
| 67 | 67 | if (!is_array($instance->with) || !in_array('translations', $instance->with)) { |
| 68 | 68 | $instance->unsetRelation('translations'); |
| 69 | - } else { |
|
| 69 | + }else { |
|
| 70 | 70 | // TODO: this is a heavy queryload since it loads new translations for each model... |
| 71 | 71 | // Removing this could reduce load by approx. 50%. |
| 72 | 72 | // $instance->load('translations'); |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | |
| 59 | 59 | protected function initializeMorphable() |
| 60 | 60 | { |
| 61 | - if(!isset($this->morph_key)) { |
|
| 61 | + if (!isset($this->morph_key)) { |
|
| 62 | 62 | $this->morph_key = $this->morphKey(); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $this->model = $model; |
| 21 | 21 | $this->blacklist = $blacklist; |
| 22 | 22 | |
| 23 | - $this->slugResolver = function ($slug) { |
|
| 23 | + $this->slugResolver = function($slug) { |
|
| 24 | 24 | return Str::slug($slug); |
| 25 | 25 | }; |
| 26 | 26 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $i = 1; |
| 44 | 44 | |
| 45 | 45 | while (!$this->isSlugUnique($slug, $entity)) { |
| 46 | - $slug = $originalslug . '-' . $i; |
|
| 46 | + $slug = $originalslug.'-'.$i; |
|
| 47 | 47 | $i++; |
| 48 | 48 | } |
| 49 | 49 | |