@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function handle() |
17 | 17 | { |
18 | 18 | $scope = $this->getNameArgument(); |
19 | - $permissions = (false === strpos($scope,'-')) ? Permission::generate($scope) : [$scope]; |
|
19 | + $permissions = (false === strpos($scope, '-')) ? Permission::generate($scope) : [$scope]; |
|
20 | 20 | |
21 | 21 | $this->createPermissions($permissions); |
22 | 22 | $this->assignPermissionsToRoles($permissions); |
@@ -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 | /** |
@@ -47,16 +47,16 @@ discard block |
||
47 | 47 | */ |
48 | 48 | private function assignPermissionsToRoles($permissions) |
49 | 49 | { |
50 | - if(!$this->option('role')) return; |
|
50 | + if (!$this->option('role')) return; |
|
51 | 51 | |
52 | 52 | $roleNames = explode(',', $this->option('role')); |
53 | 53 | |
54 | 54 | foreach ($roleNames as $roleName) { |
55 | 55 | if ($role = Role::where('name', trim($roleName))->first()) { |
56 | 56 | $role->syncPermissions($permissions); |
57 | - $this->info('Role ' . $roleName . ' assigned the given permissions.'); |
|
58 | - } else { |
|
59 | - $this->warn('Role not found by name ' . $roleName . '!'); |
|
57 | + $this->info('Role '.$roleName.' assigned the given permissions.'); |
|
58 | + }else { |
|
59 | + $this->warn('Role not found by name '.$roleName.'!'); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
@@ -47,7 +47,9 @@ |
||
47 | 47 | */ |
48 | 48 | private function assignPermissionsToRoles($permissions) |
49 | 49 | { |
50 | - if(!$this->option('role')) return; |
|
50 | + if(!$this->option('role')) { |
|
51 | + return; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | $roleNames = explode(',', $this->option('role')); |
53 | 55 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | public function getPermissionsForIndex() |
25 | 25 | { |
26 | - $this->permissions->each(function($permission){ |
|
26 | + $this->permissions->each(function($permission) { |
|
27 | 27 | |
28 | 28 | $model = explode("_", $permission->name, 2)[1]; |
29 | 29 | $temp = $this->permission; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $abilities = ['view', 'create', 'update', 'delete']; |
21 | 21 | |
22 | 22 | return array_map(function($val) use ($scope) { |
23 | - return $val . '-'. $scope; |
|
23 | + return $val.'-'.$scope; |
|
24 | 24 | }, $abilities); |
25 | 25 | } |
26 | 26 |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | private function publishModel() |
61 | 61 | { |
62 | 62 | $this->publishFile( |
63 | - __DIR__ . '/stubs/model.php.stub', |
|
64 | - $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
63 | + __DIR__.'/stubs/model.php.stub', |
|
64 | + $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
65 | 65 | 'model' |
66 | 66 | ); |
67 | 67 | } |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | private function publishController() |
70 | 70 | { |
71 | 71 | $this->publishFile( |
72 | - __DIR__ . '/stubs/controller.php.stub', |
|
73 | - $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
72 | + __DIR__.'/stubs/controller.php.stub', |
|
73 | + $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
74 | 74 | 'controller' |
75 | 75 | ); |
76 | 76 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | protected function publishFile($from, $to, $type) |
126 | 126 | { |
127 | 127 | if ($this->filesystem->exists($to) && !$this->option('force')) { |
128 | - if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) { |
|
128 | + if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) { |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | $to = str_replace($this->dirs['base'], '', realpath($to)); |
166 | 166 | |
167 | - $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>'); |
|
167 | + $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>'); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | protected function replacePlaceholders($content) |
@@ -183,25 +183,25 @@ discard block |
||
183 | 183 | private function generateImportStatements(): string |
184 | 184 | { |
185 | 185 | return collect(['Illuminate\Database\Eloquent\Model']) |
186 | - ->map(function ($statement) { |
|
187 | - return 'use ' . $statement . ";\n "; |
|
186 | + ->map(function($statement) { |
|
187 | + return 'use '.$statement.";\n "; |
|
188 | 188 | })->implode(''); |
189 | 189 | } |
190 | 190 | |
191 | 191 | private function generateTraitStatements(): string |
192 | 192 | { |
193 | 193 | return collect($this->chosenTraits) |
194 | - ->map(function ($statement) { |
|
195 | - return 'use ' . $statement . ";\n "; |
|
194 | + ->map(function($statement) { |
|
195 | + return 'use '.$statement.";\n "; |
|
196 | 196 | })->implode(''); |
197 | 197 | } |
198 | 198 | |
199 | 199 | private function guessNamespace() |
200 | 200 | { |
201 | - if(isset($this->settings['namespace'])) return $this->settings['namespace']; |
|
201 | + if (isset($this->settings['namespace'])) return $this->settings['namespace']; |
|
202 | 202 | |
203 | 203 | // We make an estimated guess based on the project name. At Think Tomorrow, we |
204 | 204 | // have a src folder which is PSR-4 namespaced by the project name itself. |
205 | - return ucfirst(config('thinktomorrow.chief.name','App')).'\\'. ucfirst($this->plural); |
|
205 | + return ucfirst(config('thinktomorrow.chief.name', 'App')).'\\'.ucfirst($this->plural); |
|
206 | 206 | } |
207 | 207 | } |
@@ -198,7 +198,9 @@ |
||
198 | 198 | |
199 | 199 | private function guessNamespace() |
200 | 200 | { |
201 | - if(isset($this->settings['namespace'])) return $this->settings['namespace']; |
|
201 | + if(isset($this->settings['namespace'])) { |
|
202 | + return $this->settings['namespace']; |
|
203 | + } |
|
202 | 204 | |
203 | 205 | // We make an estimated guess based on the project name. At Think Tomorrow, we |
204 | 206 | // have a src folder which is PSR-4 namespaced by the project name itself. |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | |
15 | 15 | public function handle(array $translations): Page |
16 | 16 | { |
17 | - DB::transaction(function(){ |
|
17 | + DB::transaction(function() { |
|
18 | 18 | |
19 | 19 | }, 2); |
20 | 20 | |
21 | - try{ |
|
21 | + try { |
|
22 | 22 | DB::beginTransaction(); |
23 | 23 | |
24 | 24 | $page = Page::create(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | return $page->fresh(); |
38 | 38 | |
39 | - } catch(\Throwable $e){ |
|
39 | + } catch (\Throwable $e) { |
|
40 | 40 | DB::rollBack(); |
41 | 41 | throw $e; |
42 | 42 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | public function handle($id, array $translations, array $relations): Page |
16 | 16 | { |
17 | - try{ |
|
17 | + try { |
|
18 | 18 | DB::beginTransaction(); |
19 | 19 | |
20 | 20 | $page = Page::findOrFail($id); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | DB::commit(); |
39 | 39 | return $page->fresh(); |
40 | 40 | |
41 | - } catch(\Throwable $e){ |
|
41 | + } catch (\Throwable $e) { |
|
42 | 42 | DB::rollBack(); |
43 | 43 | throw $e; |
44 | 44 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | private function savePageTranslations(Page $page, $translations) |
48 | 48 | { |
49 | - $translations = collect($translations)->map(function ($trans, $locale) { |
|
49 | + $translations = collect($translations)->map(function($trans, $locale) { |
|
50 | 50 | $trans['slug'] = strip_tags($trans['slug']); |
51 | 51 | |
52 | 52 | return $trans; |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | private function syncRelations($page, $relateds) |
61 | 61 | { |
62 | 62 | // First remove all existing children |
63 | - foreach($page->children() as $child){ |
|
63 | + foreach ($page->children() as $child) { |
|
64 | 64 | $page->rejectChild($child); |
65 | 65 | } |
66 | 66 | |
67 | - foreach(RelatedCollection::inflate($relateds) as $i => $related){ |
|
67 | + foreach (RelatedCollection::inflate($relateds) as $i => $related) { |
|
68 | 68 | $page->adoptChild($related, ['sort' => $i]); |
69 | 69 | } |
70 | 70 | } |
@@ -52,17 +52,17 @@ |
||
52 | 52 | |
53 | 53 | public function scopeSortedByCreated($query) |
54 | 54 | { |
55 | - $query->orderBy('created_at','DESC'); |
|
55 | + $query->orderBy('created_at', 'DESC'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function presentForParent(ActsAsParent $parent, Relation $relation): string |
59 | 59 | { |
60 | - return 'Dit is de relatie weergave van een pagina onder ' . $parent->id; |
|
60 | + return 'Dit is de relatie weergave van een pagina onder '.$parent->id; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public function presentForChild(ActsAsChild $child, Relation $relation): string |
64 | 64 | { |
65 | - return 'Dit is de relatie weergave van een pagina als parent voor ' . $child->id; |
|
65 | + return 'Dit is de relatie weergave van een pagina als parent voor '.$child->id; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | public function getRelationId(): string |
@@ -18,6 +18,6 @@ |
||
18 | 18 | |
19 | 19 | public static function findBySlug($slug) |
20 | 20 | { |
21 | - return self::where('slug',$slug)->first(); |
|
21 | + return self::where('slug', $slug)->first(); |
|
22 | 22 | } |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function enabledAsLabel(): string |
18 | 18 | { |
19 | 19 | // Avoid showing enabled state if there is an invitation pending |
20 | - if($this->user->invitation) return ''; |
|
20 | + if ($this->user->invitation) return ''; |
|
21 | 21 | |
22 | 22 | return $this->user->isEnabled() |
23 | 23 | ? '' |
@@ -17,7 +17,9 @@ |
||
17 | 17 | public function enabledAsLabel(): string |
18 | 18 | { |
19 | 19 | // Avoid showing enabled state if there is an invitation pending |
20 | - if($this->user->invitation) return ''; |
|
20 | + if($this->user->invitation) { |
|
21 | + return ''; |
|
22 | + } |
|
21 | 23 | |
22 | 24 | return $this->user->isEnabled() |
23 | 25 | ? '' |