@@ -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, |