@@ -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) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | private function getAllActivities() |
| 144 | 144 | { |
| 145 | - return Activity::take(20)->latest()->get()->map(function ($activity) { |
|
| 145 | + return Activity::take(20)->latest()->get()->map(function($activity) { |
|
| 146 | 146 | return $this->formatActivity($activity); |
| 147 | 147 | })->filter()->values(); |
| 148 | 148 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | private function getLoggedInUserActivities() |
| 154 | 154 | { |
| 155 | - return Activity::where('causer_id', $this->authFactory->guard('twill_users')->user()->id)->take(20)->latest()->get()->map(function ($activity) { |
|
| 155 | + return Activity::where('causer_id', $this->authFactory->guard('twill_users')->user()->id)->take(20)->latest()->get()->map(function($activity) { |
|
| 156 | 156 | return $this->formatActivity($activity); |
| 157 | 157 | })->filter()->values(); |
| 158 | 158 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | return []; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - $statsByDate = Collection::make($response['rows'] ?? [])->map(function (array $dateRow) { |
|
| 208 | + $statsByDate = Collection::make($response['rows'] ?? [])->map(function(array $dateRow) { |
|
| 209 | 209 | return [ |
| 210 | 210 | 'date' => $dateRow[0], |
| 211 | 211 | 'users' => (int) $dateRow[1], |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | 'yesterday', |
| 221 | 221 | 'week', |
| 222 | 222 | 'month', |
| 223 | - ])->mapWithKeys(function ($period) use ($statsByDate) { |
|
| 223 | + ])->mapWithKeys(function($period) use ($statsByDate) { |
|
| 224 | 224 | $stats = $this->getPeriodStats($period, $statsByDate); |
| 225 | 225 | return [ |
| 226 | 226 | $period => [ |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | 'stats' => $stats = $statsByDate->first(), |
| 258 | 258 | 'moreUsers' => $stats['users'] > $statsByDate->get(1)['users'], |
| 259 | 259 | 'morePageViews' => $stats['pageViews'] > $statsByDate->get(1)['pageViews'], |
| 260 | - 'usersData' => $statsByDate->take(7)->map(function ($stat) { |
|
| 260 | + 'usersData' => $statsByDate->take(7)->map(function($stat) { |
|
| 261 | 261 | return $stat['users']; |
| 262 | 262 | }), |
| 263 | - 'pageViewsData' => $statsByDate->take(7)->map(function ($stat) { |
|
| 263 | + 'pageViewsData' => $statsByDate->take(7)->map(function($stat) { |
|
| 264 | 264 | return $stat['pageViews']; |
| 265 | 265 | }), |
| 266 | 266 | ]; |
@@ -269,10 +269,10 @@ discard block |
||
| 269 | 269 | 'stats' => $stats = $statsByDate->get(1), |
| 270 | 270 | 'moreUsers' => $stats['users'] > $statsByDate->get(2)['users'], |
| 271 | 271 | 'morePageViews' => $stats['pageViews'] > $statsByDate->get(2)['pageViews'], |
| 272 | - 'usersData' => $statsByDate->slice(1)->take(7)->map(function ($stat) { |
|
| 272 | + 'usersData' => $statsByDate->slice(1)->take(7)->map(function($stat) { |
|
| 273 | 273 | return $stat['users']; |
| 274 | 274 | }), |
| 275 | - 'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function ($stat) { |
|
| 275 | + 'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function($stat) { |
|
| 276 | 276 | return $stat['pageViews']; |
| 277 | 277 | }), |
| 278 | 278 | ]; |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | 'stats' => $stats, |
| 296 | 296 | 'moreUsers' => $stats['users'] > $compareStats['users'], |
| 297 | 297 | 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'], |
| 298 | - 'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
| 298 | + 'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
| 299 | 299 | return $stat['users']; |
| 300 | 300 | }), |
| 301 | - 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
| 301 | + 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
| 302 | 302 | return $stat['pageViews']; |
| 303 | 303 | }), |
| 304 | 304 | ]; |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | 'stats' => $stats, |
| 322 | 322 | 'moreUsers' => $stats['users'] > $compareStats['users'], |
| 323 | 323 | 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'], |
| 324 | - 'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
| 324 | + 'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
| 325 | 325 | return $stat['users']; |
| 326 | 326 | }), |
| 327 | - 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
| 327 | + 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
| 328 | 328 | return $stat['pageViews']; |
| 329 | 329 | }), |
| 330 | 330 | ]; |
@@ -350,9 +350,9 @@ discard block |
||
| 350 | 350 | */ |
| 351 | 351 | private function getShortcuts($modules) |
| 352 | 352 | { |
| 353 | - return $modules->filter(function ($module) { |
|
| 353 | + return $modules->filter(function($module) { |
|
| 354 | 354 | return ($module['count'] ?? false) || ($module['create'] ?? false); |
| 355 | - })->map(function ($module) { |
|
| 355 | + })->map(function($module) { |
|
| 356 | 356 | $repository = $this->getRepository($module['name'], $module['repository'] ?? null); |
| 357 | 357 | |
| 358 | 358 | $moduleOptions = [ |
@@ -389,9 +389,9 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | private function getDrafts($modules) |
| 391 | 391 | { |
| 392 | - return $modules->filter(function ($module) { |
|
| 392 | + return $modules->filter(function($module) { |
|
| 393 | 393 | return ($module['draft'] ?? false); |
| 394 | - })->map(function ($module) { |
|
| 394 | + })->map(function($module) { |
|
| 395 | 395 | $repository = $this->getRepository($module['name'], $module['repository'] ?? null); |
| 396 | 396 | |
| 397 | 397 | $query = $repository->draft()->limit(3)->latest(); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | $drafts = $query->get(); |
| 404 | 404 | |
| 405 | - return $drafts->map(function ($draft) use ($module) { |
|
| 405 | + return $drafts->map(function($draft) use ($module) { |
|
| 406 | 406 | return [ |
| 407 | 407 | 'type' => ucfirst($module['label_singular'] ?? Str::singular($module['name'])), |
| 408 | 408 | 'name' => $draft->titleInDashboard ?? $draft->title, |