@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function byKey($key, $section = null) |
| 36 | 36 | { |
| 37 | - $settingQuery = $this->model->when($section, function ($query) use ($section) { |
|
| 37 | + $settingQuery = $this->model->when($section, function($query) use ($section) { |
|
| 38 | 38 | $query->where('section', $section); |
| 39 | 39 | })->where('key', $key); |
| 40 | 40 | |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function getFormFields($section = null) |
| 53 | 53 | { |
| 54 | - $settings = $this->model->when($section, function ($query) use ($section) { |
|
| 54 | + $settings = $this->model->when($section, function($query) use ($section) { |
|
| 55 | 55 | $query->where('section', $section); |
| 56 | 56 | })->with('translations', 'medias')->get(); |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | if (config('twill.media_library.translated_form_fields', false)) { |
| 60 | - $medias = $settings->reduce(function ($carry, $setting) { |
|
| 60 | + $medias = $settings->reduce(function($carry, $setting) { |
|
| 61 | 61 | foreach (getLocales() as $locale) { |
| 62 | 62 | if (!empty(parent::getFormFields($setting)['medias'][$locale]) && !empty(parent::getFormFields($setting)['medias'][$locale][$setting->key])) |
| 63 | 63 | { |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | return $carry; |
| 68 | 68 | }); |
| 69 | 69 | } else { |
| 70 | - $medias = $settings->mapWithKeys(function ($setting) { |
|
| 70 | + $medias = $settings->mapWithKeys(function($setting) { |
|
| 71 | 71 | return [$setting->key => parent::getFormFields($setting)['medias'][$setting->key] ?? null]; |
| 72 | 72 | })->filter()->toArray(); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return $settings->mapWithKeys(function ($setting) { |
|
| 75 | + return $settings->mapWithKeys(function($setting) { |
|
| 76 | 76 | $settingValue = []; |
| 77 | 77 | |
| 78 | 78 | foreach ($setting->translations as $translation) { |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | if (config('twill.media_library.translated_form_fields', false)) { |
| 125 | 125 | foreach (getLocales() as $locale) { |
| 126 | - $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function ($media) { |
|
| 126 | + $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function($media) { |
|
| 127 | 127 | return json_decode($media, true); |
| 128 | 128 | })->filter()->toArray(); |
| 129 | 129 | } |
| 130 | 130 | } else { |
| 131 | - $medias = [ |
|
| 132 | - $role => Collection::make($settingsFields['medias'][$role])->map(function ($media) { |
|
| 131 | + $medias = [ |
|
| 132 | + $role => Collection::make($settingsFields['medias'][$role])->map(function($media) { |
|
| 133 | 133 | return json_decode($media, true); |
| 134 | 134 | })->values()->filter()->toArray(), |
| 135 | 135 | ]; |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $submittedLanguages = Collection::make($fields['languages'] ?? []); |
| 34 | 34 | |
| 35 | - $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function ($language) { |
|
| 35 | + $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function($language) { |
|
| 36 | 36 | return $language['published']; |
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | 39 | foreach ($locales as $index => $locale) { |
| 40 | - $submittedLanguage = Arr::first($submittedLanguages->filter(function ($lang) use ($locale) { |
|
| 40 | + $submittedLanguage = Arr::first($submittedLanguages->filter(function($lang) use ($locale) { |
|
| 41 | 41 | return $lang['value'] == $locale; |
| 42 | 42 | })); |
| 43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $fields[$locale] = [ |
| 49 | 49 | 'active' => $activeField, |
| 50 | - ] + $attributes->mapWithKeys(function ($attribute) use (&$fields, $locale, $localesCount, $index) { |
|
| 50 | + ] + $attributes->mapWithKeys(function($attribute) use (&$fields, $locale, $localesCount, $index) { |
|
| 51 | 51 | $attributeValue = $fields[$attribute] ?? null; |
| 52 | 52 | |
| 53 | 53 | // if we are at the last locale, |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | if ($this->model->isTranslatable()) { |
| 108 | 108 | $attributes = $this->model->translatedAttributes; |
| 109 | - $query->whereHas('translations', function ($q) use ($scopes, $attributes) { |
|
| 109 | + $query->whereHas('translations', function($q) use ($scopes, $attributes) { |
|
| 110 | 110 | foreach ($attributes as $attribute) { |
| 111 | 111 | if (isset($scopes[$attribute]) && is_string($scopes[$attribute])) { |
| 112 | 112 | $q->where($attribute, $this->getLikeOperator(), '%' . $scopes[$attribute] . '%'); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public static function bootHasMedias(): void |
| 21 | 21 | { |
| 22 | - self::deleted(static function (Model $model) { |
|
| 22 | + self::deleted(static function(Model $model) { |
|
| 23 | 23 | if (!method_exists($model, 'isForceDeleting') || $model->isForceDeleting()) { |
| 24 | 24 | /** @var \A17\Twill\Models\Behaviors\HasMedias $model */ |
| 25 | 25 | $model->medias()->detach(); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | private function findMedia($role, $crop = "default") |
| 56 | 56 | { |
| 57 | 57 | $foundMedia = false; |
| 58 | - $media = $this->medias->first(function ($media) use ($role, $crop, &$foundMedia) { |
|
| 58 | + $media = $this->medias->first(function($media) use ($role, $crop, &$foundMedia) { |
|
| 59 | 59 | if (config('twill.media_library.translated_form_fields', false)) { |
| 60 | 60 | $localeScope = $media->pivot->locale === app()->getLocale(); |
| 61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | }); |
| 69 | 69 | |
| 70 | 70 | if (!$media && config('twill.media_library.translated_form_fields', false)) { |
| 71 | - $media = $this->medias->first(function ($media) use ($role, $crop, &$foundMedia) { |
|
| 71 | + $media = $this->medias->first(function($media) use ($role, $crop, &$foundMedia) { |
|
| 72 | 72 | if (!$foundMedia) { |
| 73 | 73 | $foundMedia = $media->pivot->role === $role; |
| 74 | 74 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function images($role, $crop = "default", $params = []) |
| 148 | 148 | { |
| 149 | - $medias = $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 149 | + $medias = $this->medias->filter(function($media) use ($role, $crop) { |
|
| 150 | 150 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 151 | 151 | }); |
| 152 | 152 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function imagesWithCrops($role, $params = []) |
| 170 | 170 | { |
| 171 | - $medias = $this->medias->filter(function ($media) use ($role) { |
|
| 171 | + $medias = $this->medias->filter(function($media) use ($role) { |
|
| 172 | 172 | return $media->pivot->role === $role; |
| 173 | 173 | }); |
| 174 | 174 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function imagesAsArrays($role, $crop = "default", $params = []) |
| 223 | 223 | { |
| 224 | - $medias = $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 224 | + $medias = $this->medias->filter(function($media) use ($role, $crop) { |
|
| 225 | 225 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 226 | 226 | }); |
| 227 | 227 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | public function imagesAsArraysWithCrops($role, $params = []) |
| 245 | 245 | { |
| 246 | - $medias = $this->medias->filter(function ($media) use ($role) { |
|
| 246 | + $medias = $this->medias->filter(function($media) use ($role) { |
|
| 247 | 247 | return $media->pivot->role === $role; |
| 248 | 248 | }); |
| 249 | 249 | |
@@ -267,12 +267,12 @@ discard block |
||
| 267 | 267 | public function imageAltText($role, $media = null) |
| 268 | 268 | { |
| 269 | 269 | if (!$media) { |
| 270 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 270 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 271 | 271 | if (config('twill.media_library.translated_form_fields', false)) { |
| 272 | 272 | $localeScope = $media->pivot->locale === app()->getLocale(); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - return $media->pivot->role === $role && ($localeScope ?? true);; |
|
| 275 | + return $media->pivot->role === $role && ($localeScope ?? true); ; |
|
| 276 | 276 | }); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | public function imageCaption($role, $media = null) |
| 294 | 294 | { |
| 295 | 295 | if (!$media) { |
| 296 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 296 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 297 | 297 | if (config('twill.media_library.translated_form_fields', false)) { |
| 298 | 298 | $localeScope = $media->pivot->locale === app()->getLocale(); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - return $media->pivot->role === $role && ($localeScope ?? true);; |
|
| 301 | + return $media->pivot->role === $role && ($localeScope ?? true); ; |
|
| 302 | 302 | }); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -319,12 +319,12 @@ discard block |
||
| 319 | 319 | public function imageVideo($role, $media = null) |
| 320 | 320 | { |
| 321 | 321 | if (!$media) { |
| 322 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 322 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 323 | 323 | if (config('twill.media_library.translated_form_fields', false)) { |
| 324 | 324 | $localeScope = $media->pivot->locale === app()->getLocale(); |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - return $media->pivot->role === $role && ($localeScope ?? true);; |
|
| 327 | + return $media->pivot->role === $role && ($localeScope ?? true); ; |
|
| 328 | 328 | }); |
| 329 | 329 | } |
| 330 | 330 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | */ |
| 442 | 442 | public function imageObjects($role, $crop = "default") |
| 443 | 443 | { |
| 444 | - return $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 444 | + return $this->medias->filter(function($media) use ($role, $crop) { |
|
| 445 | 445 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 446 | 446 | }); |
| 447 | 447 | } |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | public function rules() |
| 27 | 27 | { |
| 28 | 28 | switch ($this->method()) { |
| 29 | - case 'POST':{return $this->rulesForCreate();} |
|
| 30 | - case 'PUT':{return $this->rulesForUpdate();} |
|
| 29 | + case 'POST':{return $this->rulesForCreate(); } |
|
| 30 | + case 'PUT':{return $this->rulesForUpdate(); } |
|
| 31 | 31 | default:break; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if (! $localeActive) { |
|
| 59 | + if (!$localeActive) { |
|
| 60 | 60 | $rules = $this->updateRules($rules, $fields, reset($locales)); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | $fieldRules = Collection::make($fieldRules); |
| 83 | 83 | |
| 84 | 84 | // Remove required rules, when locale is not active |
| 85 | - if (! $localeActive) { |
|
| 86 | - $hasRequiredRule = $fieldRules->contains(function ($rule) { |
|
| 85 | + if (!$localeActive) { |
|
| 86 | + $hasRequiredRule = $fieldRules->contains(function($rule) { |
|
| 87 | 87 | return $this->ruleStartsWith($rule, 'required'); |
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | - $fieldRules = $fieldRules->reject(function ($rule) { |
|
| 90 | + $fieldRules = $fieldRules->reject(function($rule) { |
|
| 91 | 91 | return $this->ruleStartsWith($rule, 'required'); |
| 92 | 92 | }); |
| 93 | 93 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $rules["{$field}.{$locale}"] = $fieldRules->map(function ($rule) use ($locale, $fieldNames) { |
|
| 99 | + $rules["{$field}.{$locale}"] = $fieldRules->map(function($rule) use ($locale, $fieldNames) { |
|
| 100 | 100 | // allows using validation rule that references other fields even for translated fields |
| 101 | 101 | if ($this->ruleStartsWith($rule, 'required_') && Str::contains($rule, $fieldNames)) { |
| 102 | 102 | foreach ($fieldNames as $fieldName) { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function scopeMine($query) |
| 24 | 24 | { |
| 25 | - return $query->whereHas('revisions', function ($query) { |
|
| 25 | + return $query->whereHas('revisions', function($query) { |
|
| 26 | 26 | $query->where('user_id', auth('twill_users')->user()->id); |
| 27 | 27 | }); |
| 28 | 28 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function revisionsArray() |
| 36 | 36 | { |
| 37 | - return $this->revisions->map(function ($revision, $index) { |
|
| 37 | + return $this->revisions->map(function($revision, $index) { |
|
| 38 | 38 | return [ |
| 39 | 39 | 'id' => $revision->id, |
| 40 | 40 | 'author' => $revision->user->name ?? 'Unknown', |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | if (method_exists($query->getModel(), 'translations')) { |
| 37 | 37 | $locale = $locale == null ? app()->getLocale() : $locale; |
| 38 | 38 | |
| 39 | - $query->whereHas('translations', function ($query) use ($locale) { |
|
| 39 | + $query->whereHas('translations', function($query) use ($locale) { |
|
| 40 | 40 | $query->whereActive(true); |
| 41 | 41 | $query->whereLocale($locale); |
| 42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | - return $query->with(['translations' => function ($query) use ($locale) { |
|
| 48 | + return $query->with(['translations' => function($query) use ($locale) { |
|
| 49 | 49 | $query->whereActive(true); |
| 50 | 50 | $query->whereLocale($locale); |
| 51 | 51 | |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | $locale = $locale == null ? app()->getLocale() : $locale; |
| 73 | 73 | |
| 74 | 74 | return $query |
| 75 | - ->join($translationTable, function (JoinClause $join) use ($translationTable, $localeKey, $table, $keyName) { |
|
| 75 | + ->join($translationTable, function(JoinClause $join) use ($translationTable, $localeKey, $table, $keyName) { |
|
| 76 | 76 | $join |
| 77 | - ->on($translationTable.'.'.$this->getRelationKey(), '=', $table.'.'.$keyName) |
|
| 78 | - ->where($translationTable.'.'.$localeKey, $this->locale()); |
|
| 77 | + ->on($translationTable . '.' . $this->getRelationKey(), '=', $table . '.' . $keyName) |
|
| 78 | + ->where($translationTable . '.' . $localeKey, $this->locale()); |
|
| 79 | 79 | }) |
| 80 | - ->where($translationTable.'.'.$this->getLocaleKey(), $locale) |
|
| 81 | - ->orderBy($translationTable.'.'.$orderField, $orderType) |
|
| 82 | - ->select($table.'.*') |
|
| 80 | + ->where($translationTable . '.' . $this->getLocaleKey(), $locale) |
|
| 81 | + ->orderBy($translationTable . '.' . $orderField, $orderType) |
|
| 82 | + ->select($table . '.*') |
|
| 83 | 83 | ->with('translations'); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function getActiveLanguages() |
| 133 | 133 | { |
| 134 | - return Collection::make(getLocales())->map(function ($locale) { |
|
| 134 | + return Collection::make(getLocales())->map(function($locale) { |
|
| 135 | 135 | $translation = $this->translations->firstWhere('locale', $locale); |
| 136 | 136 | |
| 137 | 137 | return [ |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function translatedAttribute($key) |
| 153 | 153 | { |
| 154 | - return $this->translations->mapWithKeys(function ($translation) use ($key) { |
|
| 154 | + return $this->translations->mapWithKeys(function($translation) use ($key) { |
|
| 155 | 155 | return [$translation->locale => $this->translate($translation->locale)->$key]; |
| 156 | 156 | }); |
| 157 | 157 | } |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $modules = Collection::make($this->config->get('twill.dashboard.modules')); |
| 110 | 110 | |
| 111 | - return $modules->filter(function ($module) { |
|
| 111 | + return $modules->filter(function($module) { |
|
| 112 | 112 | return ($module['search'] ?? false); |
| 113 | - })->map(function ($module) use ($request) { |
|
| 113 | + })->map(function($module) use ($request) { |
|
| 114 | 114 | $repository = $this->getRepository($module['name'], $module['repository'] ?? null); |
| 115 | 115 | |
| 116 | 116 | $found = $repository->cmsSearch($request->get('search'), $module['search_fields'] ?? ['title'])->take(10); |
| 117 | 117 | |
| 118 | - return $found->map(function ($item) use ($module) { |
|
| 118 | + return $found->map(function($item) use ($module) { |
|
| 119 | 119 | try { |
| 120 | 120 | $author = $item->revisions()->latest()->first()->user->name ?? 'Admin'; |
| 121 | 121 | } catch (\Exception $e) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | private function getAllActivities() |
| 151 | 151 | { |
| 152 | - return Activity::take(20)->latest()->get()->map(function ($activity) { |
|
| 152 | + return Activity::take(20)->latest()->get()->map(function($activity) { |
|
| 153 | 153 | return $this->formatActivity($activity); |
| 154 | 154 | })->filter()->values(); |
| 155 | 155 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | private function getLoggedInUserActivities() |
| 161 | 161 | { |
| 162 | - return Activity::where('causer_id', $this->authFactory->guard('twill_users')->user()->id)->take(20)->latest()->get()->map(function ($activity) { |
|
| 162 | + return Activity::where('causer_id', $this->authFactory->guard('twill_users')->user()->id)->take(20)->latest()->get()->map(function($activity) { |
|
| 163 | 163 | return $this->formatActivity($activity); |
| 164 | 164 | })->filter()->values(); |
| 165 | 165 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | return []; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $statsByDate = Collection::make($response['rows'] ?? [])->map(function (array $dateRow) { |
|
| 215 | + $statsByDate = Collection::make($response['rows'] ?? [])->map(function(array $dateRow) { |
|
| 216 | 216 | return [ |
| 217 | 217 | 'date' => $dateRow[0], |
| 218 | 218 | 'users' => (int) $dateRow[1], |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | 'yesterday', |
| 250 | 250 | 'week', |
| 251 | 251 | 'month', |
| 252 | - ])->mapWithKeys(function ($period) use ($statsByDate, $dummyData) { |
|
| 252 | + ])->mapWithKeys(function($period) use ($statsByDate, $dummyData) { |
|
| 253 | 253 | |
| 254 | 254 | if ($dummyData) { |
| 255 | 255 | return [$period => $dummyData]; |
@@ -291,10 +291,10 @@ discard block |
||
| 291 | 291 | 'stats' => $stats = $statsByDate->first(), |
| 292 | 292 | 'moreUsers' => $stats['users'] > $statsByDate->get(1)['users'], |
| 293 | 293 | 'morePageViews' => $stats['pageViews'] > $statsByDate->get(1)['pageViews'], |
| 294 | - 'usersData' => $statsByDate->take(7)->map(function ($stat) { |
|
| 294 | + 'usersData' => $statsByDate->take(7)->map(function($stat) { |
|
| 295 | 295 | return $stat['users']; |
| 296 | 296 | }), |
| 297 | - 'pageViewsData' => $statsByDate->take(7)->map(function ($stat) { |
|
| 297 | + 'pageViewsData' => $statsByDate->take(7)->map(function($stat) { |
|
| 298 | 298 | return $stat['pageViews']; |
| 299 | 299 | }), |
| 300 | 300 | ]; |
@@ -303,10 +303,10 @@ discard block |
||
| 303 | 303 | 'stats' => $stats = $statsByDate->get(1), |
| 304 | 304 | 'moreUsers' => $stats['users'] > $statsByDate->get(2)['users'], |
| 305 | 305 | 'morePageViews' => $stats['pageViews'] > $statsByDate->get(2)['pageViews'], |
| 306 | - 'usersData' => $statsByDate->slice(1)->take(7)->map(function ($stat) { |
|
| 306 | + 'usersData' => $statsByDate->slice(1)->take(7)->map(function($stat) { |
|
| 307 | 307 | return $stat['users']; |
| 308 | 308 | }), |
| 309 | - 'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function ($stat) { |
|
| 309 | + 'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function($stat) { |
|
| 310 | 310 | return $stat['pageViews']; |
| 311 | 311 | }), |
| 312 | 312 | ]; |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | 'stats' => $stats, |
| 330 | 330 | 'moreUsers' => $stats['users'] > $compareStats['users'], |
| 331 | 331 | 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'], |
| 332 | - 'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
| 332 | + 'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
| 333 | 333 | return $stat['users']; |
| 334 | 334 | }), |
| 335 | - 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
| 335 | + 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
| 336 | 336 | return $stat['pageViews']; |
| 337 | 337 | }), |
| 338 | 338 | ]; |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | 'stats' => $stats, |
| 356 | 356 | 'moreUsers' => $stats['users'] > $compareStats['users'], |
| 357 | 357 | 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'], |
| 358 | - 'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
| 358 | + 'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
| 359 | 359 | return $stat['users']; |
| 360 | 360 | }), |
| 361 | - 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
| 361 | + 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
| 362 | 362 | return $stat['pageViews']; |
| 363 | 363 | }), |
| 364 | 364 | ]; |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | private function getShortcuts($modules) |
| 386 | 386 | { |
| 387 | - return $modules->filter(function ($module) { |
|
| 387 | + return $modules->filter(function($module) { |
|
| 388 | 388 | return ($module['count'] ?? false) || ($module['create'] ?? false); |
| 389 | - })->map(function ($module) { |
|
| 389 | + })->map(function($module) { |
|
| 390 | 390 | $repository = $this->getRepository($module['name'], $module['repository'] ?? null); |
| 391 | 391 | |
| 392 | 392 | $moduleOptions = [ |
@@ -424,9 +424,9 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | private function getDrafts($modules) |
| 426 | 426 | { |
| 427 | - return $modules->filter(function ($module) { |
|
| 427 | + return $modules->filter(function($module) { |
|
| 428 | 428 | return ($module['draft'] ?? false); |
| 429 | - })->map(function ($module) { |
|
| 429 | + })->map(function($module) { |
|
| 430 | 430 | $repository = $this->getRepository($module['name'], $module['repository'] ?? null); |
| 431 | 431 | |
| 432 | 432 | $query = $repository->draft()->limit(3)->latest(); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | $drafts = $query->get(); |
| 439 | 439 | |
| 440 | - return $drafts->map(function ($draft) use ($module) { |
|
| 440 | + return $drafts->map(function($draft) use ($module) { |
|
| 441 | 441 | return [ |
| 442 | 442 | 'type' => ucfirst($module['label_singular'] ?? Str::singular($module['name'])), |
| 443 | 443 | 'name' => $draft->titleInDashboard ?? $draft->title, |