@@ -75,6 +75,6 @@ |
||
75 | 75 | |
76 | 76 | public function getShortNameAttribute() |
77 | 77 | { |
78 | - return $this->firstname . ' ' . substr($this->lastname, 0, 1) . '.'; |
|
78 | + return $this->firstname.' '.substr($this->lastname, 0, 1).'.'; |
|
79 | 79 | } |
80 | 80 | } |
@@ -19,15 +19,15 @@ |
||
19 | 19 | { |
20 | 20 | $abilities = ['view', 'create', 'update', 'delete']; |
21 | 21 | |
22 | - return array_map(function ($val) use ($scope) { |
|
23 | - return $val . '-'. $scope; |
|
22 | + return array_map(function($val) use ($scope) { |
|
23 | + return $val.'-'.$scope; |
|
24 | 24 | }, $abilities); |
25 | 25 | } |
26 | 26 | |
27 | 27 | public static function getPermissionsForIndex() |
28 | 28 | { |
29 | 29 | $permissions = $temp = []; |
30 | - self::all()->each(function ($permission) use (&$permissions, &$temp) { |
|
30 | + self::all()->each(function($permission) use (&$permissions, &$temp) { |
|
31 | 31 | $model = explode("_", $permission->name, 2)[1]; |
32 | 32 | $temp[$model][$permission->id] = explode("_", $permission->name, 2)[0]; |
33 | 33 | $permissions = $temp; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | Permission::findOrCreate($permission, 'chief'); |
40 | 40 | } |
41 | 41 | |
42 | - $this->info('Permissions ' . implode(', ', $permissions) . ' created.'); |
|
42 | + $this->info('Permissions '.implode(', ', $permissions).' created.'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | foreach ($roleNames as $roleName) { |
57 | 57 | if ($role = Role::where('name', trim($roleName))->first()) { |
58 | 58 | $role->syncPermissions($permissions); |
59 | - $this->info('Role ' . $roleName . ' assigned the given permissions.'); |
|
60 | - } else { |
|
61 | - $this->warn('Role not found by name ' . $roleName . '!'); |
|
59 | + $this->info('Role '.$roleName.' assigned the given permissions.'); |
|
60 | + }else { |
|
61 | + $this->warn('Role not found by name '.$roleName.'!'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // Generate all permissions if only scope is passed |
43 | 43 | if (false === strpos($permissionName, '-')) { |
44 | 44 | $cleanPermissionNames = array_merge($cleanPermissionNames, Permission::generate($permissionName)); |
45 | - } else { |
|
45 | + }else { |
|
46 | 46 | // Trim the value |
47 | 47 | $cleanPermissionNames[] = $permissionName; |
48 | 48 | } |
@@ -55,6 +55,6 @@ discard block |
||
55 | 55 | $role->givePermissionTo($cleanPermissionName); |
56 | 56 | } |
57 | 57 | |
58 | - $this->info('Role ' . $role->name . ' was assigned the permissions: ' . implode(',', $cleanPermissionNames)); |
|
58 | + $this->info('Role '.$role->name.' was assigned the permissions: '.implode(',', $cleanPermissionNames)); |
|
59 | 59 | } |
60 | 60 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | private function removeExistingSets() |
91 | 91 | { |
92 | 92 | foreach ($this->model->children() as $instance) { |
93 | - if (! $instance instanceof StoredSetReference) { |
|
93 | + if (!$instance instanceof StoredSetReference) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | 96 | $this->model->rejectChild($instance); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | foreach ($this->text_modules['replace'] as $text_module) { |
147 | - if (! $module = FlatReferenceFactory::fromString($text_module['id'])->instance()) { |
|
147 | + if (!$module = FlatReferenceFactory::fromString($text_module['id'])->instance()) { |
|
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | private function removeTextualModule($module) |
165 | 165 | { |
166 | - if (! $module instanceof TextModule && ! $module instanceof PagetitleModule) { |
|
166 | + if (!$module instanceof TextModule && !$module instanceof PagetitleModule) { |
|
167 | 167 | throw new \Exception('Invalid request to remove non textual module'); |
168 | 168 | } |
169 | 169 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | continue; |
186 | 186 | } |
187 | 187 | |
188 | - $child = $children->first(function ($c) use ($reference) { |
|
188 | + $child = $children->first(function($c) use ($reference) { |
|
189 | 189 | return $c->flatReference()->get() == $reference; |
190 | 190 | }); |
191 | 191 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | private function stripTagsBlacklist($value, $blacklist = []) |
237 | 237 | { |
238 | 238 | foreach ($blacklist as $tag) { |
239 | - $value = preg_replace('/<\/?' . $tag . '(.|\s)*?>/', '', $value); |
|
239 | + $value = preg_replace('/<\/?'.$tag.'(.|\s)*?>/', '', $value); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | return $value; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace Thinktomorrow\Chief\Menu; |
5 | 5 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $collection = NodeCollection::fromArray($items); |
28 | 28 | |
29 | - $collection->mapRecursive(function ($node) { |
|
29 | + $collection->mapRecursive(function($node) { |
|
30 | 30 | return $node->replaceEntry((new MenuItem())->entry($node)); |
31 | 31 | }); |
32 | 32 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function items(): NodeCollection |
44 | 44 | { |
45 | 45 | if (!$this->includeHidden) { |
46 | - $this->collection = $this->collection->shake(function ($node) { |
|
46 | + $this->collection = $this->collection->shake(function($node) { |
|
47 | 47 | return !$node->hidden_in_menu && !$node->draft; |
48 | 48 | }); |
49 | 49 | } |
@@ -56,22 +56,22 @@ discard block |
||
56 | 56 | $this->collection = $this->items(); |
57 | 57 | |
58 | 58 | if ($id) { |
59 | - $this->collection = $this->collection->prune(function ($node) use ($id) { |
|
59 | + $this->collection = $this->collection->prune(function($node) use ($id) { |
|
60 | 60 | return !in_array($id, $node->pluckAncestors('id')); |
61 | 61 | }); |
62 | 62 | } |
63 | 63 | |
64 | - $menu = $this->collection->mapRecursive(function ($node) { |
|
64 | + $menu = $this->collection->mapRecursive(function($node) { |
|
65 | 65 | $entry = $node->entry(); |
66 | 66 | $label = $entry->label; |
67 | - $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())) . '>' : ''; |
|
67 | + $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())).'>' : ''; |
|
68 | 68 | $entry->label .= $label; |
69 | 69 | return $node->replaceEntry($entry); |
70 | 70 | }); |
71 | 71 | |
72 | 72 | $menuitems = collect(); |
73 | - $menu->flatten()->each(function ($node) use ($menuitems) { |
|
74 | - $menuitems[] = [ |
|
73 | + $menu->flatten()->each(function($node) use ($menuitems) { |
|
74 | + $menuitems[] = [ |
|
75 | 75 | 'label' => $node->label, |
76 | 76 | 'id' => $node->id |
77 | 77 | ]; |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | { |
28 | 28 | $types = config('thinktomorrow.chief.menus', []); |
29 | 29 | |
30 | - return collect($types)->map(function ($menu, $key) { |
|
30 | + return collect($types)->map(function($menu, $key) { |
|
31 | 31 | return new static($key, $menu['label'], $menu['view']); |
32 | 32 | }); |
33 | 33 | } |
34 | 34 | |
35 | 35 | public static function find($key): ?self |
36 | 36 | { |
37 | - return static::all()->filter(function ($menu) use ($key) { |
|
37 | + return static::all()->filter(function($menu) use ($key) { |
|
38 | 38 | return $menu->key() == $key; |
39 | 39 | })->first(); |
40 | 40 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $menu = []; |
85 | 85 | |
86 | - $this->items()->each(function ($item) use (&$menu) { |
|
86 | + $this->items()->each(function($item) use (&$menu) { |
|
87 | 87 | $menu[] = sprintf('<li><a href="%s">%s</a></li>', $item->url, $item->label); |
88 | 88 | }); |
89 | 89 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $files = collect(); |
26 | 26 | |
27 | 27 | foreach ($paths as $path) { |
28 | - if (! $fullpath = self::constructFullPath($path)) { |
|
28 | + if (!$fullpath = self::constructFullPath($path)) { |
|
29 | 29 | continue; |
30 | 30 | } |
31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - return static::$loadedSnippets = new static($files->map(function (SplFileInfo $file) { |
|
40 | + return static::$loadedSnippets = new static($files->map(function(SplFileInfo $file) { |
|
41 | 41 | $path = $file->getRealPath(); |
42 | 42 | |
43 | 43 | if (0 === strpos($path, resource_path('views')) && false !== strpos($file->getBasename(), '.blade.php')) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | $key = substr($file->getBasename(), 0, strpos($file->getBasename(), '.')); |
48 | - $label = ucfirst(str_replace(['-','_'], ' ', $key)); |
|
48 | + $label = ucfirst(str_replace(['-', '_'], ' ', $key)); |
|
49 | 49 | |
50 | 50 | return new Snippet($key, $label, $path); |
51 | 51 | })->all()); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $loadedSnippets = static::load(); |
57 | 57 | |
58 | - return $loadedSnippets->first(function (Snippet $snippet) use ($key) { |
|
58 | + return $loadedSnippets->first(function(Snippet $snippet) use ($key) { |
|
59 | 59 | return $snippet->key() == $key; |
60 | 60 | }); |
61 | 61 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | public function toClips(): array |
88 | 88 | { |
89 | - return $this->map(function ($snippet) { |
|
89 | + return $this->map(function($snippet) { |
|
90 | 90 | return [$snippet->label(), $snippet->placeholder()]; |
91 | 91 | })->toArray(); |
92 | 92 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Thinktomorrow\Chief\Snippets; |
6 | 6 |