@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | public function getFormOptions($record, Field $field, Module $module) : array |
40 | 40 | { |
41 | 41 | if (!is_object($field->data)) { |
42 | - return []; |
|
42 | + return [ ]; |
|
43 | 43 | } |
44 | 44 | |
45 | - $options = []; |
|
45 | + $options = [ ]; |
|
46 | 46 | |
47 | 47 | if ($field->data->module) { |
48 | 48 | $options = [ |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'property' => $field->data->field ?? 'recordLabel', |
51 | 51 | 'empty_value' => uctrans('select_empty_value', $module), |
52 | 52 | 'selected' => $record->{$field->column} ?? null, |
53 | - 'query_builder' => function ($relatedRecord) use($record) { |
|
53 | + 'query_builder' => function($relatedRecord) use($record) { |
|
54 | 54 | // If related record class is the same as the record one, ignore the current record |
55 | 55 | if (get_class($relatedRecord) === get_class($record)) { |
56 | 56 | return $relatedRecord->where($relatedRecord->getKeyName(), '!=', $record->getKey()); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getDefaultDatabaseColumn(Field $field) : string |
73 | 73 | { |
74 | - return $field->name . '_id'; |
|
74 | + return $field->name.'_id'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | // Get all modules |
147 | 147 | $modules = Module::orderBy('name')->get(); |
148 | 148 | |
149 | - $choices = []; |
|
149 | + $choices = [ ]; |
|
150 | 150 | foreach ($modules as $_module) { |
151 | - $choices[] = $_module->name; |
|
151 | + $choices[ ] = $_module->name; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | // Add module itself if necessary |
155 | 155 | if (!in_array($module->name, $choices)) { |
156 | - $choices[] = $module->name; |
|
156 | + $choices[ ] = $module->name; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // Sort |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function getFormOptions($record, Field $field, Module $module) : array |
35 | 35 | { |
36 | - $options['attr'] = ['class' => 'form-control weekpicker']; |
|
36 | + $options[ 'attr' ] = [ 'class' => 'form-control weekpicker' ]; |
|
37 | 37 | |
38 | 38 | return $options; |
39 | 39 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * @param \Uccello\Core\Models\Module|null $module |
60 | 60 | * @return string|null |
61 | 61 | */ |
62 | - public function getFormattedValueToSave(Request $request, Field $field, $value, $record=null, ?Domain $domain=null, ?Module $module=null) : ?string |
|
62 | + public function getFormattedValueToSave(Request $request, Field $field, $value, $record = null, ?Domain $domain = null, ?Module $module = null) : ?string |
|
63 | 63 | { |
64 | 64 | return $value ?? 0; |
65 | 65 | } |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | public function askFieldOptions(\StdClass &$module, \StdClass &$field, InputInterface $input, OutputInterface $output) |
37 | 37 | { |
38 | 38 | // Minimum value |
39 | - $field->data->min = (int) $output->ask('What is the minimum value?', 0); |
|
39 | + $field->data->min = (int)$output->ask('What is the minimum value?', 0); |
|
40 | 40 | |
41 | 41 | // Maximum value |
42 | - $field->data->max = (int) $output->ask('What is the maximum value?', 100); |
|
42 | + $field->data->max = (int)$output->ask('What is the maximum value?', 100); |
|
43 | 43 | |
44 | 44 | // Increment |
45 | - $field->data->step = (int) $output->ask('What is the increment?', 1); |
|
45 | + $field->data->step = (int)$output->ask('What is the increment?', 1); |
|
46 | 46 | |
47 | 47 | // Initial values |
48 | 48 | $field->data->start = $output->ask('Initial values (can be multiple) e.g. [10,30]', '[0]'); |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | // Maximum gap |
51 | 51 | $limit = $output->ask('What is the maximum gap between two values?'); |
52 | 52 | if (!is_null($limit)) { |
53 | - $field->data->limit = (int) $limit; |
|
53 | + $field->data->limit = (int)$limit; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Minimum gap |
57 | - $margin = (int) $output->ask('What is the minimum gap between two values?'); |
|
57 | + $margin = (int)$output->ask('What is the minimum gap between two values?'); |
|
58 | 58 | if (!is_null($margin)) { |
59 | - $field->data->margin = (int) $margin; |
|
59 | + $field->data->margin = (int)$margin; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
63 | 63 | \ No newline at end of file |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function getFormOptions($record, Field $field, Module $module) : array |
35 | 35 | { |
36 | - $options['attr'] = ['class' => 'form-control monthpicker']; |
|
36 | + $options[ 'attr' ] = [ 'class' => 'form-control monthpicker' ]; |
|
37 | 37 | |
38 | 38 | return $options; |
39 | 39 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function getFormOptions($record, Field $field, Module $module) : array |
26 | 26 | { |
27 | - return []; |
|
27 | + return [ ]; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param \Uccello\Core\Models\Module|null $module |
71 | 71 | * @return string|null |
72 | 72 | */ |
73 | - public function getFormattedValueToSave(Request $request, Field $field, $value, $record=null, ?Domain $domain=null, ?Module $module=null) : ?string |
|
73 | + public function getFormattedValueToSave(Request $request, Field $field, $value, $record = null, ?Domain $domain = null, ?Module $module = null) : ?string |
|
74 | 74 | { |
75 | 75 | return $value; |
76 | 76 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $this->info('Copying login controller...'); |
72 | 72 | copy( |
73 | - __DIR__ . '/stubs/make/app/Http/Controllers/Auth/LoginController.stub', |
|
73 | + __DIR__.'/stubs/make/app/Http/Controllers/Auth/LoginController.stub', |
|
74 | 74 | app_path('Http/Controllers/Auth/LoginController.php') |
75 | 75 | ); |
76 | 76 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | protected function createDirectories() |
122 | 122 | { |
123 | - if (! is_dir(resource_path('views/errors'))) { |
|
123 | + if (!is_dir(resource_path('views/errors'))) { |
|
124 | 124 | mkdir(resource_path('views/errors'), 0755, true); |
125 | 125 | } |
126 | 126 | } |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | $user = $event->record; |
39 | 39 | |
40 | 40 | $oldPrivileges = $this->getUserPrivileges($event); |
41 | - $newPrivileges = []; |
|
41 | + $newPrivileges = [ ]; |
|
42 | 42 | |
43 | - $roleIds = (array) $event->request->input('roles'); |
|
43 | + $roleIds = (array)$event->request->input('roles'); |
|
44 | 44 | |
45 | - foreach($roleIds as $roleId) { |
|
45 | + foreach ($roleIds as $roleId) { |
|
46 | 46 | $role = Role::find($roleId); |
47 | 47 | |
48 | 48 | if (is_null($role) || $role->domain->id !== $domain->id) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | // Create a new privilege and ignore duplicates |
53 | - $newPrivileges[] = Privilege::firstOrCreate([ |
|
53 | + $newPrivileges[ ] = Privilege::firstOrCreate([ |
|
54 | 54 | 'domain_id' => $domain->id, |
55 | 55 | 'role_id' => $role->id, |
56 | 56 | 'user_id' => $user->id |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function getUserPrivileges(AfterSaveEvent $event) : array |
71 | 71 | { |
72 | - $privileges = []; |
|
72 | + $privileges = [ ]; |
|
73 | 73 | |
74 | 74 | $domain = $event->domain; |
75 | 75 | $user = $event->record; |
76 | 76 | |
77 | 77 | foreach ($user->privileges->where('domain_id', $domain->id) as $privilege) { |
78 | - $privileges[] = $privilege; |
|
78 | + $privileges[ ] = $privilege; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return $privileges; |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $user = $this->auth->user(); |
42 | 42 | |
43 | 43 | $oldPermissions = $this->getProfilePermissions($event); |
44 | - $newPermissions = []; |
|
44 | + $newPermissions = [ ]; |
|
45 | 45 | |
46 | - $permissions = (array) $request->input('permissions'); |
|
46 | + $permissions = (array)$request->input('permissions'); |
|
47 | 47 | |
48 | 48 | foreach ($permissions as $moduleName => $capabilities) { |
49 | 49 | // Retrieve module from name |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // Create a new permisison and ignore duplicates |
67 | - $newPermissions[] = Permission::firstOrCreate([ |
|
67 | + $newPermissions[ ] = Permission::firstOrCreate([ |
|
68 | 68 | 'profile_id' => $profile->id, |
69 | 69 | 'module_id' => $module->id, |
70 | 70 | 'capability_id' => $capability->id |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function getProfilePermissions(AfterSaveEvent $event) : array |
86 | 86 | { |
87 | - $permissions = []; |
|
87 | + $permissions = [ ]; |
|
88 | 88 | |
89 | 89 | $domain = $event->domain; |
90 | 90 | $profile = $event->record; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | foreach ($profilePermissions as $permission) { |
96 | 96 | if ($user->canAdmin($domain, $permission->module)) { |
97 | - $permissions[] = $permission; |
|
97 | + $permissions[ ] = $permission; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 |