@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $this->isNewFormat = $this->isNewFormat($contents); |
205 | 205 | $this->contents = $contents; |
206 | 206 | |
207 | - $this->parseMixedProperty('titleField', $contents, $this->name, function ($value, $options) { |
|
207 | + $this->parseMixedProperty('titleField', $contents, $this->name, function($value, $options) { |
|
208 | 208 | $this->titleField = $value; |
209 | 209 | $this->hideTitlePrefix = (boolean) ($options['hidePrefix'] ?? false); |
210 | 210 | }); |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | return $value; |
312 | 312 | } |
313 | 313 | |
314 | - if ($configBlock = collect(config("twill.block_editor.blocks"))->filter(function ($block) use ($blockName) { |
|
314 | + if ($configBlock = collect(config("twill.block_editor.blocks"))->filter(function($block) use ($blockName) { |
|
315 | 315 | return Str::contains($block['component'], $blockName); |
316 | 316 | })->first()) { |
317 | 317 | if ($value = ($configBlock[$property] ?? null)) { |
318 | 318 | return $value; |
319 | 319 | } |
320 | 320 | } |
321 | - if ($configRepeater = collect(config("twill.block_editor.repeaters"))->filter(function ($repeater) use ($blockName) { |
|
321 | + if ($configRepeater = collect(config("twill.block_editor.repeaters"))->filter(function($repeater) use ($blockName) { |
|
322 | 322 | return Str::contains($repeater['component'], $blockName); |
323 | 323 | })->first()) { |
324 | 324 | if ($value = ($configRepeater[$property] ?? null)) { |
@@ -123,7 +123,7 @@ |
||
123 | 123 | |
124 | 124 | try { |
125 | 125 | $process->start(); |
126 | - } catch(\Exception $e) { |
|
126 | + } catch (\Exception $e) { |
|
127 | 127 | $this->warn("Could not start the chokidar watcher ({$e->getMessage()})\n"); |
128 | 128 | } |
129 | 129 | } else { |
@@ -54,7 +54,7 @@ |
||
54 | 54 | if ($frontend) { |
55 | 55 | $view = config('twill.frontend.views_path') . ".errors.$statusCode"; |
56 | 56 | |
57 | - return view()->exists($view)? $view : "errors::{$statusCode}"; |
|
57 | + return view()->exists($view) ? $view : "errors::{$statusCode}"; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $view = "admin.errors.$statusCode"; |
@@ -17,11 +17,11 @@ |
||
17 | 17 | */ |
18 | 18 | public function hydrateHandleRevisions($object, $fields) |
19 | 19 | { |
20 | - foreach($this->getRepeaters() as $repeater) { |
|
20 | + foreach ($this->getRepeaters() as $repeater) { |
|
21 | 21 | $this->hydrateRepeater($object, $fields, $repeater['relation'], $repeater['model']); |
22 | 22 | } |
23 | 23 | |
24 | - foreach($this->getBrowsers() as $browser) { |
|
24 | + foreach ($this->getBrowsers() as $browser) { |
|
25 | 25 | $this->hydrateBrowser($object, $fields, $browser['relation'], $browser['positionAttribute'], $browser['model']); |
26 | 26 | } |
27 | 27 |
@@ -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 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | 'date' => $activity->created_at->toIso8601String(), |
180 | 180 | 'author' => $activity->causer->name ?? twillTrans('twill::lang.dashboard.unknown-author'), |
181 | 181 | 'name' => $activity->subject->titleInDashboard ?? $activity->subject->title, |
182 | - 'activity' => twillTrans('twill::lang.dashboard.activities.'.$activity->description), |
|
182 | + 'activity' => twillTrans('twill::lang.dashboard.activities.' . $activity->description), |
|
183 | 183 | ] + (classHasTrait($activity->subject, HasMedias::class) ? [ |
184 | 184 | 'thumbnail' => $activity->subject->defaultCmsImage(['w' => 100, 'h' => 100]), |
185 | 185 | ] : []) + (!$activity->subject->trashed() ? [ |
@@ -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, |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public function handle() |
27 | 27 | { |
28 | - DB::transaction(function () { |
|
28 | + DB::transaction(function() { |
|
29 | 29 | app($this->modelClass)->saveTreeFromIds($this->ids); |
30 | 30 | }, 3); |
31 | 31 | } |
@@ -85,12 +85,12 @@ |
||
85 | 85 | { |
86 | 86 | foreach ($this->fieldsGroups as $group => $groupFields) { |
87 | 87 | if ($this->fieldsGroupsFormFieldNamesAutoPrefix) { |
88 | - $groupFields = array_map(function ($field_name) use ($group) { |
|
88 | + $groupFields = array_map(function($field_name) use ($group) { |
|
89 | 89 | return $group . $this->fieldsGroupsFormFieldNameSeparator . $field_name; |
90 | 90 | }, $groupFields); |
91 | 91 | } |
92 | 92 | |
93 | - $fields[$group] = Arr::where(Arr::only($fields, $groupFields), function ($value, $key) { |
|
93 | + $fields[$group] = Arr::where(Arr::only($fields, $groupFields), function($value, $key) { |
|
94 | 94 | return !empty($value); |
95 | 95 | }); |
96 | 96 |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | $middlewares, |
83 | 83 | $supportSubdomainRouting |
84 | 84 | ) { |
85 | - $internalRoutes = function ($router) use ( |
|
85 | + $internalRoutes = function($router) use ( |
|
86 | 86 | $middlewares, |
87 | 87 | $supportSubdomainRouting |
88 | 88 | ) { |
89 | - $router->group(['middleware' => $middlewares], function ($router) { |
|
89 | + $router->group(['middleware' => $middlewares], function($router) { |
|
90 | 90 | require __DIR__ . '/../routes/admin.php'; |
91 | 91 | }); |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | ? ['supportSubdomainRouting'] |
97 | 97 | : [], |
98 | 98 | ], |
99 | - function ($router) { |
|
99 | + function($router) { |
|
100 | 100 | require __DIR__ . '/../routes/auth.php'; |
101 | 101 | } |
102 | 102 | ); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ? ['twill_auth:twill_users'] |
108 | 108 | : [], |
109 | 109 | ], |
110 | - function ($router) { |
|
110 | + function($router) { |
|
111 | 111 | require __DIR__ . '/../routes/templates.php'; |
112 | 112 | } |
113 | 113 | ); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $groupOptions + [ |
118 | 118 | 'namespace' => $this->namespace . '\Admin', |
119 | 119 | ], |
120 | - function ($router) use ($internalRoutes, $supportSubdomainRouting) { |
|
120 | + function($router) use ($internalRoutes, $supportSubdomainRouting) { |
|
121 | 121 | $router->group( |
122 | 122 | [ |
123 | 123 | 'domain' => config('twill.admin_app_url'), |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | config('twill.admin_middleware_group', 'web'), |
149 | 149 | ], |
150 | 150 | ], |
151 | - function ($router) { |
|
151 | + function($router) { |
|
152 | 152 | $router->group( |
153 | 153 | [ |
154 | 154 | 'middleware' => $this->app->environment( |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ? ['twill_auth:twill_users'] |
158 | 158 | : [], |
159 | 159 | ], |
160 | - function ($router) { |
|
160 | + function($router) { |
|
161 | 161 | require __DIR__ . '/../routes/templates.php'; |
162 | 162 | } |
163 | 163 | ); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | protected function registerMacros() |
212 | 212 | { |
213 | - Route::macro('moduleShowWithPreview', function ( |
|
213 | + Route::macro('moduleShowWithPreview', function( |
|
214 | 214 | $moduleName, |
215 | 215 | $routePrefix = null, |
216 | 216 | $controllerName = null |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | ->middleware(['web', 'twill_auth:twill_users', 'can:list']); |
245 | 245 | }); |
246 | 246 | |
247 | - Route::macro('module', function ( |
|
247 | + Route::macro('module', function( |
|
248 | 248 | $slug, |
249 | 249 | $options = [], |
250 | 250 | $resource_options = [], |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $_slug = Arr::last($slugs); |
256 | 256 | $className = implode( |
257 | 257 | '', |
258 | - array_map(function ($s) { |
|
258 | + array_map(function($s) { |
|
259 | 259 | return ucfirst(Str::singular($s)); |
260 | 260 | }, $slugs) |
261 | 261 | ); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | if ($resource) { |
381 | 381 | Route::group( |
382 | 382 | ['as' => $resourceCustomGroupPrefix], |
383 | - function () use ($slug, $className, $resource_options) { |
|
383 | + function() use ($slug, $className, $resource_options) { |
|
384 | 384 | Route::resource( |
385 | 385 | $slug, |
386 | 386 | "{$className}Controller", |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | } |
392 | 392 | }); |
393 | 393 | |
394 | - Route::macro('singleton', function ( |
|
394 | + Route::macro('singleton', function( |
|
395 | 395 | $slug, |
396 | 396 | $options = [], |
397 | 397 | $resource_options = [], |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $domain = config('twill.twicpics.domain'); |
98 | 98 | $path = config('twill.twicpics.path'); |
99 | 99 | |
100 | - if (! empty($path)) { |
|
100 | + if (!empty($path)) { |
|
101 | 101 | $path = "{$path}/"; |
102 | 102 | } |
103 | 103 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $params = $this->paramsProcessor->process($params); |
128 | 128 | |
129 | - $manipulations = collect($params)->map(function ($value, $key) { |
|
129 | + $manipulations = collect($params)->map(function($value, $key) { |
|
130 | 130 | return "{$key}={$value}"; |
131 | 131 | })->join('/'); |
132 | 132 |