@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $items = $this->getIndexItems($scopes); |
95 | 95 | |
96 | 96 | return [ |
97 | - 'items' => $items->map(function ($item) { |
|
97 | + 'items' => $items->map(function($item) { |
|
98 | 98 | return $item->toCmsArray(); |
99 | 99 | })->toArray(), |
100 | 100 | 'maxPage' => $items->lastPage(), |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $ids = explode(',', $this->request->input('ids')); |
218 | 218 | |
219 | - $metadatasFromRequest = $this->getExtraMetadatas()->reject(function ($meta) { |
|
219 | + $metadatasFromRequest = $this->getExtraMetadatas()->reject(function($meta) { |
|
220 | 220 | return is_null($meta); |
221 | 221 | })->toArray(); |
222 | 222 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $items = $this->getIndexItems($scopes); |
241 | 241 | |
242 | 242 | return $this->responseFactory->json([ |
243 | - 'items' => $items->map(function ($item) { |
|
243 | + 'items' => $items->map(function($item) { |
|
244 | 244 | return $item->toCmsArray(); |
245 | 245 | })->toArray(), |
246 | 246 | 'tags' => $this->repository->getTagsList(), |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | private function getExtraMetadatas() |
281 | 281 | { |
282 | - return Collection::make($this->customFields)->mapWithKeys(function ($field) { |
|
282 | + return Collection::make($this->customFields)->mapWithKeys(function($field) { |
|
283 | 283 | $fieldInRequest = $this->request->get($field['name']); |
284 | 284 | |
285 | 285 | if (isset($field['type']) && $field['type'] === 'checkbox') { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $items = $this->getIndexItems($scopes); |
89 | 89 | |
90 | 90 | return [ |
91 | - 'items' => $items->map(function ($item) { |
|
91 | + 'items' => $items->map(function($item) { |
|
92 | 92 | return $this->buildFile($item); |
93 | 93 | })->toArray(), |
94 | 94 | 'maxPage' => $items->lastPage(), |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | private function buildFile($item) |
105 | 105 | { |
106 | 106 | return $item->toCmsArray() + [ |
107 | - 'tags' => $item->tags->map(function ($tag) { |
|
107 | + 'tags' => $item->tags->map(function($tag) { |
|
108 | 108 | return $tag->name; |
109 | 109 | }), |
110 | 110 | 'deleteUrl' => $item->canDeleteSafely() ? moduleRoute($this->moduleName, $this->routePrefix, 'destroy', $item->id) : null, |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $items = $this->getIndexItems($scopes); |
226 | 226 | |
227 | 227 | return $this->responseFactory->json([ |
228 | - 'items' => $items->map(function ($item) { |
|
228 | + 'items' => $items->map(function($item) { |
|
229 | 229 | return $this->buildFile($item); |
230 | 230 | })->toArray(), |
231 | 231 | 'tags' => $this->repository->getTagsList(), |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | "$this->viewPrefix.index", |
314 | 314 | "twill::$this->moduleName.index", |
315 | 315 | "twill::layouts.listing", |
316 | - ])->first(function ($view) { |
|
316 | + ])->first(function($view) { |
|
317 | 317 | return View::exists($view); |
318 | 318 | }); |
319 | 319 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | "$this->viewPrefix.form", |
394 | 394 | "twill::$this->moduleName.form", |
395 | 395 | "twill::layouts.form", |
396 | - ])->first(function ($view) { |
|
396 | + ])->first(function($view) { |
|
397 | 397 | return View::exists($view); |
398 | 398 | }); |
399 | 399 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | "$this->viewPrefix.form", |
510 | 510 | "twill::$this->moduleName.form", |
511 | 511 | "twill::layouts.form", |
512 | - ])->first(function ($view) { |
|
512 | + ])->first(function($view) { |
|
513 | 513 | return View::exists($view); |
514 | 514 | }); |
515 | 515 | |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $query = $this->request->input('q'); |
729 | 729 | $tags = $this->repository->getTags($query); |
730 | 730 | |
731 | - return Response::json(['items' => $tags->map(function ($tag) { |
|
731 | + return Response::json(['items' => $tags->map(function($tag) { |
|
732 | 732 | return $tag->name; |
733 | 733 | })], 200); |
734 | 734 | } |
@@ -813,8 +813,8 @@ discard block |
||
813 | 813 | protected function getIndexTableData($items) |
814 | 814 | { |
815 | 815 | $translated = $this->moduleHas('translations'); |
816 | - return $items->map(function ($item) use ($translated) { |
|
817 | - $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function ($column) use ($item) { |
|
816 | + return $items->map(function($item) use ($translated) { |
|
817 | + $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function($column) use ($item) { |
|
818 | 818 | return $this->getItemColumnData($item, $column); |
819 | 819 | })->toArray(); |
820 | 820 | |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | 'feature', |
1070 | 1070 | 'bulkFeature', |
1071 | 1071 | 'bulkDelete', |
1072 | - ])->mapWithKeys(function ($endpoint) { |
|
1072 | + ])->mapWithKeys(function($endpoint) { |
|
1073 | 1073 | return [ |
1074 | 1074 | $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute( |
1075 | 1075 | $this->moduleName, $this->routePrefix, $endpoint, |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | */ |
1086 | 1086 | protected function getIndexOption($option) |
1087 | 1087 | { |
1088 | - return once(function () use ($option) { |
|
1088 | + return once(function() use ($option) { |
|
1089 | 1089 | $customOptionNamesMapping = [ |
1090 | 1090 | 'store' => 'create', |
1091 | 1091 | ]; |
@@ -1140,8 +1140,8 @@ discard block |
||
1140 | 1140 | { |
1141 | 1141 | $withImage = $this->moduleHas('medias'); |
1142 | 1142 | |
1143 | - return $items->map(function ($item) use ($withImage) { |
|
1144 | - $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function ($column) use ($item) { |
|
1143 | + return $items->map(function($item) use ($withImage) { |
|
1144 | + $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function($column) use ($item) { |
|
1145 | 1145 | return $this->getItemColumnData($item, $column); |
1146 | 1146 | })->toArray(); |
1147 | 1147 | |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | $fieldSplitted = explode('|', $field); |
1208 | 1208 | if (count($fieldSplitted) > 1) { |
1209 | 1209 | $requestValue = $requestFilters[$key]; |
1210 | - Collection::make($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) { |
|
1210 | + Collection::make($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) { |
|
1211 | 1211 | $scope[$scopeKey] = $requestValue; |
1212 | 1212 | }); |
1213 | 1213 | } else { |
@@ -1353,11 +1353,11 @@ discard block |
||
1353 | 1353 | */ |
1354 | 1354 | protected function validateFormRequest() |
1355 | 1355 | { |
1356 | - $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function ($permission, $field) { |
|
1356 | + $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function($permission, $field) { |
|
1357 | 1357 | return Auth::guard('twill_users')->user()->cannot($permission); |
1358 | 1358 | })->keys(); |
1359 | 1359 | |
1360 | - $unauthorizedFields->each(function ($field) { |
|
1360 | + $unauthorizedFields->each(function($field) { |
|
1361 | 1361 | $this->request->offsetUnset($field); |
1362 | 1362 | }); |
1363 | 1363 |
@@ -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 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | return []; |
202 | 202 | } |
203 | 203 | |
204 | - $statsByDate = Collection::make($response['rows'] ?? [])->map(function (array $dateRow) { |
|
204 | + $statsByDate = Collection::make($response['rows'] ?? [])->map(function(array $dateRow) { |
|
205 | 205 | return [ |
206 | 206 | 'date' => $dateRow[0], |
207 | 207 | 'users' => (int) $dateRow[1], |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | 'yesterday', |
217 | 217 | 'week', |
218 | 218 | 'month', |
219 | - ])->mapWithKeys(function ($period) use ($statsByDate) { |
|
219 | + ])->mapWithKeys(function($period) use ($statsByDate) { |
|
220 | 220 | $stats = $this->getPeriodStats($period, $statsByDate); |
221 | 221 | return [ |
222 | 222 | $period => [ |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | 'stats' => $stats = $statsByDate->first(), |
254 | 254 | 'moreUsers' => $stats['users'] > $statsByDate->get(1)['users'], |
255 | 255 | 'morePageViews' => $stats['pageViews'] > $statsByDate->get(1)['pageViews'], |
256 | - 'usersData' => $statsByDate->take(7)->map(function ($stat) { |
|
256 | + 'usersData' => $statsByDate->take(7)->map(function($stat) { |
|
257 | 257 | return $stat['users']; |
258 | 258 | }), |
259 | - 'pageViewsData' => $statsByDate->take(7)->map(function ($stat) { |
|
259 | + 'pageViewsData' => $statsByDate->take(7)->map(function($stat) { |
|
260 | 260 | return $stat['pageViews']; |
261 | 261 | }), |
262 | 262 | ]; |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | 'stats' => $stats = $statsByDate->get(1), |
266 | 266 | 'moreUsers' => $stats['users'] > $statsByDate->get(2)['users'], |
267 | 267 | 'morePageViews' => $stats['pageViews'] > $statsByDate->get(2)['pageViews'], |
268 | - 'usersData' => $statsByDate->slice(1)->take(7)->map(function ($stat) { |
|
268 | + 'usersData' => $statsByDate->slice(1)->take(7)->map(function($stat) { |
|
269 | 269 | return $stat['users']; |
270 | 270 | }), |
271 | - 'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function ($stat) { |
|
271 | + 'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function($stat) { |
|
272 | 272 | return $stat['pageViews']; |
273 | 273 | }), |
274 | 274 | ]; |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | 'stats' => $stats, |
292 | 292 | 'moreUsers' => $stats['users'] > $compareStats['users'], |
293 | 293 | 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'], |
294 | - 'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
294 | + 'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
295 | 295 | return $stat['users']; |
296 | 296 | }), |
297 | - 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
297 | + 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
298 | 298 | return $stat['pageViews']; |
299 | 299 | }), |
300 | 300 | ]; |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | 'stats' => $stats, |
318 | 318 | 'moreUsers' => $stats['users'] > $compareStats['users'], |
319 | 319 | 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'], |
320 | - 'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
320 | + 'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
321 | 321 | return $stat['users']; |
322 | 322 | }), |
323 | - 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) { |
|
323 | + 'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) { |
|
324 | 324 | return $stat['pageViews']; |
325 | 325 | }), |
326 | 326 | ]; |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | */ |
347 | 347 | private function getShortcuts($modules) |
348 | 348 | { |
349 | - return $modules->filter(function ($module) { |
|
349 | + return $modules->filter(function($module) { |
|
350 | 350 | return ($module['count'] ?? false) || ($module['create'] ?? false); |
351 | - })->map(function ($module) { |
|
351 | + })->map(function($module) { |
|
352 | 352 | $repository = $this->getRepository($module['name'], $module['repository'] ?? null); |
353 | 353 | |
354 | 354 | $moduleOptions = [ |
@@ -385,14 +385,14 @@ discard block |
||
385 | 385 | */ |
386 | 386 | private function getDrafts($modules) |
387 | 387 | { |
388 | - return $modules->filter(function ($module) { |
|
388 | + return $modules->filter(function($module) { |
|
389 | 389 | return ($module['draft'] ?? false); |
390 | - })->map(function ($module) { |
|
390 | + })->map(function($module) { |
|
391 | 391 | $repository = $this->getRepository($module['name'], $module['repository'] ?? null); |
392 | 392 | |
393 | 393 | $drafts = $repository->draft()->mine()->limit(3)->latest()->get(); |
394 | 394 | |
395 | - return $drafts->map(function ($draft) use ($module) { |
|
395 | + return $drafts->map(function($draft) use ($module) { |
|
396 | 396 | return [ |
397 | 397 | 'type' => ucfirst($module['label_singular'] ?? Str::singular($module['name'])), |
398 | 398 | 'name' => $draft->titleInDashboard ?? $draft->title, |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $featuredSources = $this->getFeaturedSources($request, $featuredSection, $filters['search'] ?? ''); |
44 | 44 | |
45 | - $contentTypes = Collection::make($featuredSources)->map(function ($source, $sourceKey) { |
|
45 | + $contentTypes = Collection::make($featuredSources)->map(function($source, $sourceKey) { |
|
46 | 46 | return [ |
47 | 47 | 'label' => $source['name'], |
48 | 48 | 'value' => $sourceKey, |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | return [ |
56 | 56 | 'source' => [ |
57 | - 'content_type' => Arr::first($contentTypes, function ($contentTypeItem) use ($request) { |
|
57 | + 'content_type' => Arr::first($contentTypes, function($contentTypeItem) use ($request) { |
|
58 | 58 | return $contentTypeItem['value'] == $request->get('content_type'); |
59 | 59 | }), |
60 | 60 | 'items' => $source['items'], |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | private function getFeaturedItemsByBucket($featuredSection, $featuredSectionKey) |
101 | 101 | { |
102 | 102 | $bucketRouteConfig = $this->config->get('twill.bucketsRoutes') ?? [$featuredSectionKey => 'featured']; |
103 | - return Collection::make($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) { |
|
103 | + return Collection::make($featuredSection['buckets'])->map(function($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) { |
|
104 | 104 | $routePrefix = $bucketRouteConfig[$featuredSectionKey]; |
105 | 105 | return [ |
106 | 106 | 'id' => $bucketKey, |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'acceptedSources' => Collection::make($bucket['bucketables'])->pluck('module'), |
110 | 110 | 'withToggleFeatured' => $bucket['with_starred_items'] ?? false, |
111 | 111 | 'toggleFeaturedLabels' => $bucket['starred_items_labels'] ?? [], |
112 | - 'children' => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function ($feature) use ($bucket) { |
|
112 | + 'children' => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function($feature) use ($bucket) { |
|
113 | 113 | if (($item = $feature->featured) != null) { |
114 | 114 | $forModuleRepository = collect($bucket['bucketables'])->where('module', $feature->featured_type)->first()['repository'] ?? null; |
115 | 115 | $repository = $this->getRepository($feature->featured_type, $forModuleRepository); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'thumbnail' => $item->defaultCmsImage(['w' => 100, 'h' => 100]), |
129 | 129 | ] : []); |
130 | 130 | } |
131 | - })->reject(function ($item) { |
|
131 | + })->reject(function($item) { |
|
132 | 132 | return is_null($item); |
133 | 133 | })->values()->toArray(), |
134 | 134 | ]; |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $fetchedModules = []; |
147 | 147 | $featuredSources = []; |
148 | 148 | |
149 | - Collection::make($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use (&$fetchedModules, $search, $request) { |
|
150 | - return Collection::make($bucket['bucketables'])->mapWithKeys(function ($bucketable) use (&$fetchedModules, $search, $request) { |
|
149 | + Collection::make($featuredSection['buckets'])->map(function($bucket, $bucketKey) use (&$fetchedModules, $search, $request) { |
|
150 | + return Collection::make($bucket['bucketables'])->mapWithKeys(function($bucketable) use (&$fetchedModules, $search, $request) { |
|
151 | 151 | |
152 | 152 | $module = $bucketable['module']; |
153 | 153 | $repository = $this->getRepository($module, $bucketable['repository'] ?? null); |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | 'withImage' => $withImage, |
177 | 177 | ]]; |
178 | 178 | }); |
179 | - })->each(function ($bucketables, $bucket) use (&$featuredSources) { |
|
180 | - $bucketables->each(function ($bucketableData, $bucketable) use (&$featuredSources) { |
|
179 | + })->each(function($bucketables, $bucket) use (&$featuredSources) { |
|
180 | + $bucketables->each(function($bucketableData, $bucketable) use (&$featuredSources) { |
|
181 | 181 | $featuredSources[$bucketable]['name'] = $bucketableData['name']; |
182 | 182 | $featuredSources[$bucketable]['maxPage'] = $bucketableData['items']->lastPage(); |
183 | 183 | $featuredSources[$bucketable]['offset'] = $bucketableData['items']->perPage(); |
184 | - $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function ($item) use ($bucketableData, $bucketable) { |
|
184 | + $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function($item) use ($bucketableData, $bucketable) { |
|
185 | 185 | return [ |
186 | 186 | 'id' => $item->id, |
187 | 187 | 'name' => $item->titleInBucket ?? $item->title, |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function save(Request $request, DB $db) |
212 | 212 | { |
213 | - $db->transaction(function () use ($request) { |
|
214 | - Collection::make($request->get('buckets'))->each(function ($bucketables, $bucketKey) { |
|
213 | + $db->transaction(function() use ($request) { |
|
214 | + Collection::make($request->get('buckets'))->each(function($bucketables, $bucketKey) { |
|
215 | 215 | Feature::where('bucket_key', $bucketKey)->delete(); |
216 | 216 | foreach (($bucketables ?? []) as $position => $bucketable) { |
217 | 217 | Feature::create([ |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | if (Schema::hasTable(config('twill.related_table', 'twill_related'))) { |
46 | 46 | $relatedItems = Collection::make(); |
47 | 47 | |
48 | - Collection::make($fields['browsers'])->each(function ($items, $browserName) use (&$relatedItems) { |
|
49 | - Collection::make($items)->each(function ($item) use ($browserName, &$relatedItems) { |
|
48 | + Collection::make($fields['browsers'])->each(function($items, $browserName) use (&$relatedItems) { |
|
49 | + Collection::make($items)->each(function($item) use ($browserName, &$relatedItems) { |
|
50 | 50 | try { |
51 | 51 | $repository = $this->getModelRepository($item['endpointType'] ?? $browserName); |
52 | 52 | $relatedItems->push((object) [ |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | if (Schema::hasTable(config('twill.related_table', 'twill_related'))) { |
76 | 76 | if (isset($fields['browsers'])) { |
77 | - Collection::make($fields['browsers'])->each(function ($items, $browserName) use ($object) { |
|
77 | + Collection::make($fields['browsers'])->each(function($items, $browserName) use ($object) { |
|
78 | 78 | $object->saveRelated($items, $browserName); |
79 | 79 | }); |
80 | 80 | } |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | { |
103 | 103 | $blocksFromConfig = $this->config->get('twill.block_editor.' . ($repeater ? 'repeaters' : 'blocks')); |
104 | 104 | |
105 | - $block['type'] = Collection::make($blocksFromConfig)->search(function ($blockConfig) use ($block) { |
|
105 | + $block['type'] = Collection::make($blocksFromConfig)->search(function($blockConfig) use ($block) { |
|
106 | 106 | return $blockConfig['component'] === $block['type']; |
107 | 107 | }); |
108 | 108 | |
109 | 109 | $block['content'] = empty($block['content']) ? new \stdClass : (object) $block['content']; |
110 | 110 | |
111 | 111 | if ($block['browsers']) { |
112 | - $browsers = Collection::make($block['browsers'])->map(function ($items) { |
|
112 | + $browsers = Collection::make($block['browsers'])->map(function($items) { |
|
113 | 113 | return Collection::make($items)->pluck('id'); |
114 | 114 | })->toArray(); |
115 | 115 |
@@ -16,23 +16,23 @@ |
||
16 | 16 | */ |
17 | 17 | public function boot() |
18 | 18 | { |
19 | - Validator::extend('absolute_or_relative_url', function ($attribute, $value, $parameters, $validator) { |
|
19 | + Validator::extend('absolute_or_relative_url', function($attribute, $value, $parameters, $validator) { |
|
20 | 20 | return Str::startsWith($value, '/') || Validator::make([$attribute => $value], [$attribute => 'url'])->passes(); |
21 | 21 | }, 'The :attribute should be a valid url (absolute or relative)'); |
22 | 22 | |
23 | - Validator::extend('relative_or_secure_url', function ($attribute, $value, $parameters) { |
|
23 | + Validator::extend('relative_or_secure_url', function($attribute, $value, $parameters) { |
|
24 | 24 | return Str::startsWith($value, '/') || filter_var($value, FILTER_VALIDATE_URL) !== false && Str::startsWith($value, 'https'); |
25 | 25 | }, 'The :attribute should be a valid url (relative or https)'); |
26 | 26 | |
27 | - Validator::extend('web_color', function ($attribute, $value, $parameters, $validator) { |
|
27 | + Validator::extend('web_color', function($attribute, $value, $parameters, $validator) { |
|
28 | 28 | return preg_match('/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i', $value); |
29 | 29 | }); |
30 | 30 | |
31 | - Validator::extend('phone_number', function ($attribute, $value, $parameters) { |
|
31 | + Validator::extend('phone_number', function($attribute, $value, $parameters) { |
|
32 | 32 | return preg_match("/^[+]?[0-9\-\ ]*$/", $value); |
33 | 33 | }); |
34 | 34 | |
35 | - Validator::extend('validBlocks', function ($attribute, $value, $parameters, $validator) { |
|
35 | + Validator::extend('validBlocks', function($attribute, $value, $parameters, $validator) { |
|
36 | 36 | $blockMessages = []; |
37 | 37 | |
38 | 38 | foreach ($value as $block) { |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | if (config('twill.enabled.media-library')) { |
125 | - $this->app->singleton('imageService', function () { |
|
125 | + $this->app->singleton('imageService', function() { |
|
126 | 126 | return $this->app->make(config('twill.media_library.image_service')); |
127 | 127 | }); |
128 | 128 | } |
129 | 129 | |
130 | 130 | if (config('twill.enabled.file-library')) { |
131 | - $this->app->singleton('fileService', function () { |
|
131 | + $this->app->singleton('fileService', function() { |
|
132 | 132 | return $this->app->make(config('twill.file_library.file_service')); |
133 | 133 | }); |
134 | 134 | } |
@@ -305,20 +305,20 @@ discard block |
||
305 | 305 | { |
306 | 306 | $blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler(); |
307 | 307 | |
308 | - $blade->directive('dd', function ($param) { |
|
308 | + $blade->directive('dd', function($param) { |
|
309 | 309 | return "<?php dd({$param}); ?>"; |
310 | 310 | }); |
311 | 311 | |
312 | - $blade->directive('dumpData', function ($data) { |
|
312 | + $blade->directive('dumpData', function($data) { |
|
313 | 313 | return sprintf("<?php (new Symfony\Component\VarDumper\VarDumper)->dump(%s); exit; ?>", |
314 | 314 | null != $data ? $data : "get_defined_vars()"); |
315 | 315 | }); |
316 | 316 | |
317 | - $blade->directive('formField', function ($expression) { |
|
317 | + $blade->directive('formField', function($expression) { |
|
318 | 318 | return $this->includeView('partials.form._', $expression); |
319 | 319 | }); |
320 | 320 | |
321 | - $blade->directive('partialView', function ($expression) { |
|
321 | + $blade->directive('partialView', function($expression) { |
|
322 | 322 | |
323 | 323 | $expressionAsArray = str_getcsv($expression, ',', '\''); |
324 | 324 | |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | ?>"; |
355 | 355 | }); |
356 | 356 | |
357 | - $blade->directive('pushonce', function ($expression) { |
|
357 | + $blade->directive('pushonce', function($expression) { |
|
358 | 358 | list($pushName, $pushSub) = explode(':', trim(substr($expression, 1, -1))); |
359 | 359 | $key = '__pushonce_' . $pushName . '_' . str_replace('-', '_', $pushSub); |
360 | 360 | return "<?php if(! isset(\$__env->{$key})): \$__env->{$key} = 1; \$__env->startPush('{$pushName}'); ?>"; |
361 | 361 | }); |
362 | 362 | |
363 | - $blade->directive('endpushonce', function () { |
|
363 | + $blade->directive('endpushonce', function() { |
|
364 | 364 | return '<?php $__env->stopPush(); endif; ?>'; |
365 | 365 | }); |
366 | 366 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | View::composer('twill::partials.navigation.*', ActiveNavigation::class); |
388 | 388 | |
389 | - View::composer(['admin.*', 'templates.*', 'twill::*'], function ($view) { |
|
389 | + View::composer(['admin.*', 'templates.*', 'twill::*'], function($view) { |
|
390 | 390 | $with = array_merge([ |
391 | 391 | 'renderForBlocks' => false, |
392 | 392 | 'renderForModal' => false, |