@@ -10,39 +10,39 @@ discard block |
||
10 | 10 | |
11 | 11 | protected static function bootHasSlug() |
12 | 12 | { |
13 | - static::created(function ($model) { |
|
13 | + static::created(function($model) { |
|
14 | 14 | $model->setSlugs(); |
15 | 15 | }); |
16 | 16 | |
17 | - static::updated(function ($model) { |
|
17 | + static::updated(function($model) { |
|
18 | 18 | $model->setSlugs(); |
19 | 19 | }); |
20 | 20 | |
21 | - static::restored(function ($model) { |
|
21 | + static::restored(function($model) { |
|
22 | 22 | $model->setSlugs($restoring = true); |
23 | 23 | }); |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function slugs() |
27 | 27 | { |
28 | - return $this->hasMany("App\Models\Slugs\\".$this->getSlugClassName()); |
|
28 | + return $this->hasMany("App\Models\Slugs\\" . $this->getSlugClassName()); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function getSlugClass() |
32 | 32 | { |
33 | - $slugClassName = "App\Models\Slugs\\".$this->getSlugClassName(); |
|
33 | + $slugClassName = "App\Models\Slugs\\" . $this->getSlugClassName(); |
|
34 | 34 | |
35 | 35 | return new $slugClassName(); |
36 | 36 | } |
37 | 37 | |
38 | 38 | protected function getSlugClassName() |
39 | 39 | { |
40 | - return class_basename($this).'Slug'; |
|
40 | + return class_basename($this) . 'Slug'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function scopeForSlug($query, $slug) |
44 | 44 | { |
45 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
45 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
46 | 46 | $query->whereSlug($slug); |
47 | 47 | $query->whereActive(true); |
48 | 48 | $query->whereLocale(app()->getLocale()); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function scopeForInactiveSlug($query, $slug) |
53 | 53 | { |
54 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
54 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
55 | 55 | $query->whereSlug($slug); |
56 | 56 | $query->whereLocale(app()->getLocale()); |
57 | 57 | })->with(['slugs']); |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | foreach ($slugParams as $key => $value) { |
93 | 93 | //check variations of the slug |
94 | 94 | if ($key == 'slug') { |
95 | - $query->where(function ($query) use ($value) { |
|
95 | + $query->where(function($query) use ($value) { |
|
96 | 96 | $query->orWhere('slug', $value); |
97 | - $query->orWhere('slug', $value.'-'.$this->getSuffixSlug()); |
|
97 | + $query->orWhere('slug', $value . '-' . $this->getSuffixSlug()); |
|
98 | 98 | for ($i = 2; $i <= $this->nb_variation_slug; $i++) { |
99 | - $query->orWhere('slug', $value.'-'.$i); |
|
99 | + $query->orWhere('slug', $value . '-' . $i); |
|
100 | 100 | } |
101 | 101 | }); |
102 | 102 | } else { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | if (!empty($slugParams['slug'])) { |
154 | - $slugParams['slug'] = $slugBackup.(($i > $this->nb_variation_slug) ? '-'.$this->getSuffixSlug() : "-{$i}"); |
|
154 | + $slugParams['slug'] = $slugBackup . (($i > $this->nb_variation_slug) ? '-' . $this->getSuffixSlug() : "-{$i}"); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | public function getActiveSlug($locale = null) |
162 | 162 | { |
163 | - return $this->slugs->first(function ($slug) use ($locale) { |
|
163 | + return $this->slugs->first(function($slug) use ($locale) { |
|
164 | 164 | return ($slug->locale === ($locale ?? app()->getLocale())) && $slug->active; |
165 | 165 | }) ?? null; |
166 | 166 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | public function getForeignKey() |
271 | 271 | { |
272 | - return snake_case(class_basename(get_class($this))).'_id'; |
|
272 | + return snake_case(class_basename(get_class($this))) . '_id'; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | protected function getSuffixSlug() |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $str = preg_replace('/[^\p{L}\p{Nd}]+/u', $options['delimiter'], $str); |
373 | 373 | |
374 | 374 | // Remove duplicate delimiters |
375 | - $str = preg_replace('/('.preg_quote($options['delimiter'], '/').'){2,}/', '$1', $str); |
|
375 | + $str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str); |
|
376 | 376 | |
377 | 377 | // Truncate slug to max. characters |
378 | 378 | $str = mb_substr($str, 0, ($options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8')), 'UTF-8'); |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | |
14 | 14 | public function renderBlocks($renderChilds = true, $blockViewMappings = [], $data = []) |
15 | 15 | { |
16 | - return $this->blocks->where('parent_id', null)->map(function ($block) use ($blockViewMappings, $renderChilds, $data) { |
|
16 | + return $this->blocks->where('parent_id', null)->map(function($block) use ($blockViewMappings, $renderChilds, $data) { |
|
17 | 17 | if ($renderChilds) { |
18 | 18 | $childBlocks = $this->blocks->where('parent_id', $block->id); |
19 | 19 | |
20 | - $renderedChildViews = $childBlocks->map(function ($childBlock) use ($blockViewMappings, $data) { |
|
20 | + $renderedChildViews = $childBlocks->map(function($childBlock) use ($blockViewMappings, $data) { |
|
21 | 21 | $view = $this->getBlockView($childBlock->type, $blockViewMappings); |
22 | 22 | |
23 | 23 | return view($view, $data)->with('block', $childBlock)->render(); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | |
29 | 29 | $view = $this->getBlockView($block->type, $blockViewMappings); |
30 | 30 | |
31 | - return view($view, $data)->with('block', $block)->render().($renderedChildViews ?? ''); |
|
31 | + return view($view, $data)->with('block', $block)->render() . ($renderedChildViews ?? ''); |
|
32 | 32 | })->implode(''); |
33 | 33 | } |
34 | 34 | |
35 | 35 | private function getBlockView($blockType, $blockViewMappings = []) |
36 | 36 | { |
37 | - $view = config('twill.block_editor.block_views_path').'.'.$blockType; |
|
37 | + $view = config('twill.block_editor.block_views_path') . '.' . $blockType; |
|
38 | 38 | |
39 | 39 | if (array_key_exists($blockType, $blockViewMappings)) { |
40 | 40 | $view = $blockViewMappings[$blockType]; |
@@ -9,7 +9,7 @@ |
||
9 | 9 | public function present($presenter = 'presenter') |
10 | 10 | { |
11 | 11 | if (!$this->$presenter or !class_exists($this->$presenter)) { |
12 | - throw new \Exception('Please set the Presenter path to your Presenter :'.$presenter.' FQN'); |
|
12 | + throw new \Exception('Please set the Presenter path to your Presenter :' . $presenter . ' FQN'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | if (!$this->presenterInstance) { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $locale = $locale ?? app()->getLocale(); |
18 | 18 | |
19 | 19 | if (!$file) { |
20 | - $file = $this->files->first(function ($file) use ($role, $locale) { |
|
20 | + $file = $this->files->first(function($file) use ($role, $locale) { |
|
21 | 21 | $localeScope = ($locale === 'fallback') ? true : ($file->pivot->locale === $locale); |
22 | 22 | |
23 | 23 | return $file->pivot->role === $role && $localeScope; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $locale = $locale ?? app()->getLocale(); |
35 | 35 | |
36 | - $files = $this->files->filter(function ($file) use ($role, $locale) { |
|
36 | + $files = $this->files->filter(function($file) use ($role, $locale) { |
|
37 | 37 | return $file->pivot->role === $role && $file->pivot->locale === $locale; |
38 | 38 | }); |
39 | 39 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $locale = $locale ?? app()->getLocale(); |
52 | 52 | |
53 | - return $this->files->first(function ($key, $file) use ($role, $locale) { |
|
53 | + return $this->files->first(function($key, $file) use ($role, $locale) { |
|
54 | 54 | return $file->pivot->role === $role && $file->pivot->locale === $locale; |
55 | 55 | }); |
56 | 56 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | public function getTranslationModelNameDefault() |
12 | 12 | { |
13 | - return "App\Models\Translations\\".class_basename($this).'Translation'; |
|
13 | + return "App\Models\Translations\\" . class_basename($this) . 'Translation'; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public function scopeWithActiveTranslations($query, $locale = null) |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | if (method_exists($query->getModel(), 'translations')) { |
19 | 19 | $locale = $locale == null ? app()->getLocale() : $locale; |
20 | 20 | |
21 | - $query->whereHas('translations', function ($query) use ($locale) { |
|
21 | + $query->whereHas('translations', function($query) use ($locale) { |
|
22 | 22 | $query->whereActive(true); |
23 | 23 | $query->whereLocale($locale); |
24 | 24 | }); |
25 | 25 | |
26 | - return $query->with(['translations' => function ($query) use ($locale) { |
|
26 | + return $query->with(['translations' => function($query) use ($locale) { |
|
27 | 27 | $query->whereActive(true); |
28 | 28 | $query->whereLocale($locale); |
29 | 29 | }]); |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | |
76 | 76 | public function getActiveLanguages() |
77 | 77 | { |
78 | - return $this->translations->map(function ($translation) { |
|
78 | + return $this->translations->map(function($translation) { |
|
79 | 79 | return [ |
80 | 80 | 'shortlabel' => strtoupper($translation->locale), |
81 | 81 | 'label' => getLanguageLabelFromLocaleCode($translation->locale), |
82 | 82 | 'value' => $translation->locale, |
83 | 83 | 'published' => $translation->active ?? false, |
84 | 84 | ]; |
85 | - })->sortBy(function ($translation) { |
|
85 | + })->sortBy(function($translation) { |
|
86 | 86 | $localesOrdered = config('translatable.locales'); |
87 | 87 | |
88 | 88 | return array_search($translation['value'], $localesOrdered); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | public function translatedAttribute($key) |
93 | 93 | { |
94 | - return $this->translations->mapWithKeys(function ($translation) use ($key) { |
|
94 | + return $this->translations->mapWithKeys(function($translation) use ($key) { |
|
95 | 95 | return [$translation->locale => $this->translate($translation->locale)->$key]; |
96 | 96 | }); |
97 | 97 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | protected static function bootHasPosition() |
8 | 8 | { |
9 | - static::creating(function ($model) { |
|
9 | + static::creating(function($model) { |
|
10 | 10 | $model->setToLastPosition(); |
11 | 11 | }); |
12 | 12 | } |
@@ -6,19 +6,19 @@ |
||
6 | 6 | { |
7 | 7 | public function revisions() |
8 | 8 | { |
9 | - return $this->hasMany("App\Models\Revisions\\".class_basename($this).'Revision')->orderBy('created_at', 'desc'); |
|
9 | + return $this->hasMany("App\Models\Revisions\\" . class_basename($this) . 'Revision')->orderBy('created_at', 'desc'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | public function scopeMine($query) |
13 | 13 | { |
14 | - return $query->whereHas('revisions', function ($query) { |
|
14 | + return $query->whereHas('revisions', function($query) { |
|
15 | 15 | $query->where('user_id', auth()->user()->id); |
16 | 16 | }); |
17 | 17 | } |
18 | 18 | |
19 | 19 | public function revisionsArray() |
20 | 20 | { |
21 | - return $this->revisions->map(function ($revision) { |
|
21 | + return $this->revisions->map(function($revision) { |
|
22 | 22 | return [ |
23 | 23 | 'id' => $revision->id, |
24 | 24 | 'author' => $revision->user->name ?? 'Unknown', |
@@ -25,48 +25,48 @@ discard block |
||
25 | 25 | public function map(Router $router) |
26 | 26 | { |
27 | 27 | $router->group([ |
28 | - 'namespace' => config('twill.namespace', 'App').'\Http\Controllers\Admin', |
|
28 | + 'namespace' => config('twill.namespace', 'App') . '\Http\Controllers\Admin', |
|
29 | 29 | 'domain' => config('twill.admin_app_url'), |
30 | 30 | 'as' => 'admin.', |
31 | 31 | 'middleware' => [config('twill.admin_middleware_group', 'web')], |
32 | 32 | 'prefix' => rtrim(ltrim(config('twill.admin_app_path'), '/'), '/'), |
33 | - ], function ($router) { |
|
34 | - $router->group(['middleware' => ['auth', 'impersonate', 'validateBackHistory']], function ($router) { |
|
33 | + ], function($router) { |
|
34 | + $router->group(['middleware' => ['auth', 'impersonate', 'validateBackHistory']], function($router) { |
|
35 | 35 | require base_path('routes/admin.php'); |
36 | 36 | }); |
37 | 37 | }); |
38 | 38 | |
39 | 39 | $router->group([ |
40 | - 'namespace' => $this->namespace.'\Admin', |
|
40 | + 'namespace' => $this->namespace . '\Admin', |
|
41 | 41 | 'domain' => config('twill.admin_app_url'), |
42 | 42 | 'as' => 'admin.', |
43 | 43 | 'middleware' => [config('twill.admin_middleware_group', 'web')], |
44 | 44 | 'prefix' => rtrim(ltrim(config('twill.admin_app_path'), '/'), '/'), |
45 | 45 | ], |
46 | - function ($router) { |
|
47 | - $router->group(['middleware' => ['auth', 'impersonate', 'validateBackHistory']], function ($router) { |
|
48 | - require __DIR__.'/../routes/admin.php'; |
|
46 | + function($router) { |
|
47 | + $router->group(['middleware' => ['auth', 'impersonate', 'validateBackHistory']], function($router) { |
|
48 | + require __DIR__ . '/../routes/admin.php'; |
|
49 | 49 | }); |
50 | 50 | |
51 | - $router->group(['middleware' => ['noDebugBar']], function ($router) { |
|
52 | - require __DIR__.'/../routes/auth.php'; |
|
51 | + $router->group(['middleware' => ['noDebugBar']], function($router) { |
|
52 | + require __DIR__ . '/../routes/auth.php'; |
|
53 | 53 | }); |
54 | 54 | |
55 | - $router->group(['middleware' => array_merge(['noDebugBar'], (app()->environment('production') ? ['auth'] : []))], function ($router) { |
|
56 | - require __DIR__.'/../routes/templates.php'; |
|
55 | + $router->group(['middleware' => array_merge(['noDebugBar'], (app()->environment('production') ? ['auth'] : []))], function($router) { |
|
56 | + require __DIR__ . '/../routes/templates.php'; |
|
57 | 57 | }); |
58 | 58 | } |
59 | 59 | ); |
60 | 60 | |
61 | 61 | if (config('twill.templates_on_frontend_domain')) { |
62 | 62 | $router->group([ |
63 | - 'namespace' => $this->namespace.'\Admin', |
|
63 | + 'namespace' => $this->namespace . '\Admin', |
|
64 | 64 | 'domain' => config('app.url'), |
65 | 65 | 'middleware' => [config('twill.admin_middleware_group', 'web')], |
66 | 66 | ], |
67 | - function ($router) { |
|
68 | - $router->group(['middleware' => array_merge(['noDebugBar'], (app()->environment('production') ? ['auth'] : []))], function ($router) { |
|
69 | - require __DIR__.'/../routes/templates.php'; |
|
67 | + function($router) { |
|
68 | + $router->group(['middleware' => array_merge(['noDebugBar'], (app()->environment('production') ? ['auth'] : []))], function($router) { |
|
69 | + require __DIR__ . '/../routes/templates.php'; |
|
70 | 70 | }); |
71 | 71 | } |
72 | 72 | ); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | protected function registerMacros() |
90 | 90 | { |
91 | - Route::macro('moduleShowWithPreview', function ($moduleName, $routePrefix = null, $controllerName = null) { |
|
91 | + Route::macro('moduleShowWithPreview', function($moduleName, $routePrefix = null, $controllerName = null) { |
|
92 | 92 | if ($routePrefix === null) { |
93 | 93 | $routePrefix = $moduleName; |
94 | 94 | } |
@@ -97,18 +97,18 @@ discard block |
||
97 | 97 | $controllerName = ucfirst(str_plural($moduleName)); |
98 | 98 | } |
99 | 99 | |
100 | - $routePrefix = empty($routePrefix) ? '/' : (starts_with($routePrefix, '/') ? $routePrefix : '/'.$routePrefix); |
|
101 | - $routePrefix = ends_with($routePrefix, '/') ? $routePrefix : $routePrefix.'/'; |
|
100 | + $routePrefix = empty($routePrefix) ? '/' : (starts_with($routePrefix, '/') ? $routePrefix : '/' . $routePrefix); |
|
101 | + $routePrefix = ends_with($routePrefix, '/') ? $routePrefix : $routePrefix . '/'; |
|
102 | 102 | |
103 | - Route::name($moduleName.'.show')->get($routePrefix.'{slug}', $controllerName.'Controller@show'); |
|
104 | - Route::name($moduleName.'.preview')->get('/admin-preview'.$routePrefix.'{slug}', $controllerName.'Controller@show')->middleware(['web', 'auth', 'can:list']); |
|
103 | + Route::name($moduleName . '.show')->get($routePrefix . '{slug}', $controllerName . 'Controller@show'); |
|
104 | + Route::name($moduleName . '.preview')->get('/admin-preview' . $routePrefix . '{slug}', $controllerName . 'Controller@show')->middleware(['web', 'auth', 'can:list']); |
|
105 | 105 | }); |
106 | 106 | |
107 | - Route::macro('module', function ($slug, $options = [], $resource_options = [], $resource = true) { |
|
107 | + Route::macro('module', function($slug, $options = [], $resource_options = [], $resource = true) { |
|
108 | 108 | $slugs = explode('.', $slug); |
109 | 109 | $prefixSlug = str_replace('.', '/', $slug); |
110 | 110 | $_slug = Arr::last($slugs); |
111 | - $className = implode('', array_map(function ($s) { |
|
111 | + $className = implode('', array_map(function($s) { |
|
112 | 112 | return ucfirst(str_singular($s)); |
113 | 113 | }, $slugs)); |
114 | 114 | |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | |
131 | 131 | foreach ($customRoutes as $route) { |
132 | 132 | $routeSlug = "{$prefixSlug}/{$route}"; |
133 | - $mapping = ['as' => $customRoutePrefix.".{$route}", 'uses' => "{$className}Controller@{$route}"]; |
|
133 | + $mapping = ['as' => $customRoutePrefix . ".{$route}", 'uses' => "{$className}Controller@{$route}"]; |
|
134 | 134 | |
135 | 135 | if (in_array($route, ['browser', 'tags'])) { |
136 | 136 | Route::get($routeSlug, $mapping); |
137 | 137 | } |
138 | 138 | |
139 | 139 | if (in_array($route, ['status'])) { |
140 | - Route::get($routeSlug.'/{id}', $mapping); |
|
140 | + Route::get($routeSlug . '/{id}', $mapping); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | if (in_array($route, ['publish', 'feature', 'restore', 'restoreRevision'])) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | if (in_array($route, ['preview'])) { |
148 | - Route::put($routeSlug.'/{id}', $mapping); |
|
148 | + Route::put($routeSlug . '/{id}', $mapping); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (in_array($route, ['reorder', 'bulkPublish', 'bulkFeature', 'bulkDelete', 'bulkRestore'])) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | if ($resource) { |
157 | 157 | $customRoutePrefix = !empty($groupPrefix) ? "{$groupPrefix}." : ''; |
158 | - Route::group(['as' => $customRoutePrefix], function () use ($slug, $className, $resource_options) { |
|
158 | + Route::group(['as' => $customRoutePrefix], function() use ($slug, $className, $resource_options) { |
|
159 | 159 | Route::resource($slug, "{$className}Controller", $resource_options); |
160 | 160 | }); |
161 | 161 | } |
@@ -75,21 +75,21 @@ discard block |
||
75 | 75 | |
76 | 76 | private function getAllActivities() |
77 | 77 | { |
78 | - return Activity::take(20)->latest()->get()->map(function ($activity) { |
|
78 | + return Activity::take(20)->latest()->get()->map(function($activity) { |
|
79 | 79 | return $this->formatActivity($activity); |
80 | 80 | })->filter()->values(); |
81 | 81 | } |
82 | 82 | |
83 | 83 | private function getLoggedInUserActivities() |
84 | 84 | { |
85 | - return Activity::where('causer_id', auth()->user()->id)->take(20)->latest()->get()->map(function ($activity) { |
|
85 | + return Activity::where('causer_id', auth()->user()->id)->take(20)->latest()->get()->map(function($activity) { |
|
86 | 86 | return $this->formatActivity($activity); |
87 | 87 | })->filter()->values(); |
88 | 88 | } |
89 | 89 | |
90 | 90 | private function formatActivity($activity) |
91 | 91 | { |
92 | - $dashboardModule = config('twill.dashboard.modules.'.$activity->subject_type); |
|
92 | + $dashboardModule = config('twill.dashboard.modules.' . $activity->subject_type); |
|
93 | 93 | |
94 | 94 | if (!$dashboardModule) { |
95 | 95 | return; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return []; |
126 | 126 | } |
127 | 127 | |
128 | - $statsByDate = collect($response['rows'] ?? [])->map(function (array $dateRow) { |
|
128 | + $statsByDate = collect($response['rows'] ?? [])->map(function(array $dateRow) { |
|
129 | 129 | return [ |
130 | 130 | 'date' => $dateRow[0], |
131 | 131 | 'users' => (int) $dateRow[1], |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | 'yesterday', |
141 | 141 | 'week', |
142 | 142 | 'month', |
143 | - ])->mapWithKeys(function ($period) use ($statsByDate) { |
|
143 | + ])->mapWithKeys(function($period) use ($statsByDate) { |
|
144 | 144 | $stats = $this->getPeriodStats($period, $statsByDate); |
145 | 145 | |
146 | 146 | return [ |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | [ |
149 | 149 | 'label' => 'Users', |
150 | 150 | 'figure' => $this->formatStat($stats['stats']['users']), |
151 | - 'insight' => round($stats['stats']['bounceRate']).'% Bounce rate', |
|
151 | + 'insight' => round($stats['stats']['bounceRate']) . '% Bounce rate', |
|
152 | 152 | 'trend' => $stats['moreUsers'] ? 'up' : 'down', |
153 | 153 | 'data' => $stats['usersData']->reverse()->values()->toArray(), |
154 | 154 | 'url' => 'https://analytics.google.com/analytics/web', |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | [ |
157 | 157 | 'label' => 'Pageviews', |
158 | 158 | 'figure' => $this->formatStat($stats['stats']['pageViews']), |
159 | - 'insight' => round($stats['stats']['pageviewsPerSession'], 1).' Pages / Session', |
|
159 | + 'insight' => round($stats['stats']['pageviewsPerSession'], 1) . ' Pages / Session', |
|
160 | 160 | 'trend' => $stats['morePageViews'] ? 'up' : 'down', |
161 | 161 | 'data' => $stats['pageViewsData']->reverse()->values()->toArray(), |
162 | 162 | 'url' => 'https://analytics.google.com/analytics/web', |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | 'stats' => $stats = $statsByDate->first(), |
174 | 174 | 'moreUsers' => $stats['users'] > $statsByDate->get(1)['users'], |
175 | 175 | 'morePageViews' => $stats['pageViews'] > $statsByDate->get(1)['pageViews'], |
176 | - 'usersData' => $statsByDate->take(7)->map(function ($stat) { |
|
176 | + 'usersData' => $statsByDate->take(7)->map(function($stat) { |
|
177 | 177 | return $stat['users']; |
178 | 178 | }), |
179 | - 'pageViewsData' => $statsByDate->take(7)->map(function ($stat) { |
|
179 | + 'pageViewsData' => $statsByDate->take(7)->map(function($stat) { |
|
180 | 180 | return $stat['pageViews']; |
181 | 181 | }), |
182 | 182 | ]; |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | 'stats' => $stats = $statsByDate->get(1), |
186 | 186 | 'moreUsers' => $stats['users'] > $statsByDate->get(2)['users'], |
187 | 187 | 'morePageViews' => $stats['pageViews'] > $statsByDate->get(2)['pageViews'], |
188 | - 'usersData' => $statsByDate->slice(1)->take(7)->map(function ($stat) { |
|
188 | + 'usersData' => $statsByDate->slice(1)->take(7)->map(function($stat) { |
|
189 | 189 | return $stat['users']; |
190 | 190 | }), |
191 | - 'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function ($stat) { |
|
191 | + 'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function($stat) { |
|
192 | 192 | return $stat['pageViews']; |
193 | 193 | }), |
194 | 194 | ]; |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | 'stats' => $stats, |
212 | 212 | 'moreUsers' => $stats['users'] > $compareStats['users'], |
213 | 213 | 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'], |
214 | - 'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
214 | + 'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
215 | 215 | return $stat['users']; |
216 | 216 | }), |
217 | - 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
217 | + 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
218 | 218 | return $stat['pageViews']; |
219 | 219 | }), |
220 | 220 | ]; |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | 'stats' => $stats, |
238 | 238 | 'moreUsers' => $stats['users'] > $compareStats['users'], |
239 | 239 | 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'], |
240 | - 'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
240 | + 'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
241 | 241 | return $stat['users']; |
242 | 242 | }), |
243 | - 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
243 | + 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
244 | 244 | return $stat['pageViews']; |
245 | 245 | }), |
246 | 246 | ]; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | private function formatStat($count) |
251 | 251 | { |
252 | 252 | if ($count >= 1000) { |
253 | - return round($count / 1000, 1).'k'; |
|
253 | + return round($count / 1000, 1) . 'k'; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | return $count; |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | |
259 | 259 | private function getShortcuts($modules) |
260 | 260 | { |
261 | - return $modules->filter(function ($module) { |
|
261 | + return $modules->filter(function($module) { |
|
262 | 262 | return ($module['count'] ?? false) || ($module['create'] ?? false); |
263 | - })->map(function ($module) { |
|
263 | + })->map(function($module) { |
|
264 | 264 | $repository = $this->getRepository($module['name']); |
265 | 265 | |
266 | 266 | $moduleOptions = [ |
@@ -293,6 +293,6 @@ discard block |
||
293 | 293 | |
294 | 294 | private function getRepository($module) |
295 | 295 | { |
296 | - return app(config('twill.namespace')."\Repositories\\".ucfirst(str_singular($module)).'Repository'); |
|
296 | + return app(config('twill.namespace') . "\Repositories\\" . ucfirst(str_singular($module)) . 'Repository'); |
|
297 | 297 | } |
298 | 298 | } |