@@ -139,7 +139,9 @@ |
||
139 | 139 | $form->addField('create', ['CheckBox', 'caption' => __('Create New Database')])->on('change', new jsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
140 | 140 | |
141 | 141 | foreach ($wizard->recall('connection', []) as $name => $value) { |
142 | - if (! $field = $form->fields[$name]?? null) continue; |
|
142 | + if (! $field = $form->fields[$name]?? null) { |
|
143 | + continue; |
|
144 | + } |
|
143 | 145 | |
144 | 146 | $field->set($value); |
145 | 147 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $form->addField('language', ['DropDown', 'values' => $values, 'caption' => __('Select Language'), 'iconLeft' => 'globe'], ['required'=>true])->set($wizard->recall('language', 'en')); |
81 | 81 | |
82 | - $form->onSubmit(function ($form) use ($wizard) { |
|
82 | + $form->onSubmit(function($form) use ($wizard) { |
|
83 | 83 | $wizard->memorize('language', $form->model['language']); |
84 | 84 | |
85 | 85 | App::setLocale($form->model['language']); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $form->addField('support', ['CheckBox', 'caption' => __('I will not remove "Support -> About" credit page from the application menu.')], ['required'=>true]); |
112 | 112 | $form->addField('store', ['CheckBox', 'caption' => __('I will not remove or rename ":epesi Store" links from the application.', ['epesi' => config('epesi.app.title')])], ['required'=>true]); |
113 | 113 | |
114 | - $form->onSubmit(function ($form) use ($wizard) { |
|
114 | + $form->onSubmit(function($form) use ($wizard) { |
|
115 | 115 | return $wizard->jsNext(); |
116 | 116 | }); |
117 | 117 | |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | $form->addField('create', ['CheckBox', 'caption' => __('Create New Database')])->on('change', new jsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
140 | 140 | |
141 | 141 | foreach ($wizard->recall('connection', []) as $name => $value) { |
142 | - if (! $field = $form->fields[$name]?? null) continue; |
|
142 | + if (!$field = $form->fields[$name]?? null) continue; |
|
143 | 143 | |
144 | 144 | $field->set($value); |
145 | 145 | } |
146 | 146 | |
147 | - $form->onSubmit(function ($form) use ($wizard) { |
|
147 | + $form->onSubmit(function($form) use ($wizard) { |
|
148 | 148 | $connection = $form->model->get(); |
149 | 149 | |
150 | 150 | $wizard->memorize('connection', $connection); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $form->model->set($wizard->recall('user')); |
194 | 194 | |
195 | - $form->validate(function ($form) use ($wizard) { |
|
195 | + $form->validate(function($form) use ($wizard) { |
|
196 | 196 | $wizard->memorize('user', $form->model->get()); |
197 | 197 | |
198 | 198 | return $wizard->jsNext(); |
@@ -42,7 +42,9 @@ |
||
42 | 42 | }); |
43 | 43 | |
44 | 44 | $logo->onUpload(function ($files) use ($form, $logo) { |
45 | - if ($files === 'error') return $form->error('logo', __('Error uploading image')); |
|
45 | + if ($files === 'error') { |
|
46 | + return $form->error('logo', __('Error uploading image')); |
|
47 | + } |
|
46 | 48 | |
47 | 49 | $tmpPath = self::alias() . '/tmp/' . $files['name']; |
48 | 50 |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | $form->addField('custom_logo', ['CheckBox', 'caption' => __('Use custom logo')]); |
35 | 35 | |
36 | 36 | $form->model->set([ |
37 | - 'title' => Variable::recall('system.title'), |
|
38 | - 'custom_logo' => (bool) Variable::recall('system.logo') |
|
37 | + 'title' => Variable::recall('system.title'), |
|
38 | + 'custom_logo' => (bool) Variable::recall('system.logo') |
|
39 | 39 | ]); |
40 | 40 | |
41 | 41 | $logo = $form->addField('logo', [ |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $storage->move($from, $to); |
77 | 77 | } |
78 | 78 | |
79 | - Variable::memorize('system.logo', $logo); |
|
79 | + Variable::memorize('system.logo', $logo); |
|
80 | 80 | |
81 | 81 | Variable::memorize('system.title', $form->model['title']); |
82 | 82 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $logo->setThumbnailSrc(asset('storage/' . self::alias() . '/' . self::$defaultLogo)); |
54 | 54 | }); |
55 | 55 | |
56 | - $logo->onUpload(function ($files) use ($form, $logo) { |
|
56 | + $logo->onUpload(function($files) use ($form, $logo) { |
|
57 | 57 | if ($files === 'error') return $form->error('logo', __('Error uploading image')); |
58 | 58 | |
59 | 59 | $tmpPath = self::alias() . '/tmp/' . $files['name']; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | }); |
65 | 65 | |
66 | 66 | $form->onSubmit(function($form) { |
67 | - if ($logo = $form->model['custom_logo']? $form->model['logo']: null) { |
|
67 | + if ($logo = $form->model['custom_logo'] ? $form->model['logo'] : null) { |
|
68 | 68 | $storage = $this->storage(); |
69 | 69 | $from = self::alias() . '/tmp/' . $logo; |
70 | 70 | $to = self::alias() . '/' . $logo; |
@@ -8,79 +8,79 @@ |
||
8 | 8 | |
9 | 9 | class ActionButton extends View |
10 | 10 | { |
11 | - public $defaultTemplate = 'action_button.html'; |
|
11 | + public $defaultTemplate = 'action_button.html'; |
|
12 | 12 | |
13 | - public $ui = 'basic inverted action button'; |
|
13 | + public $ui = 'basic inverted action button'; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Icon that will appear on the button (top). |
|
17 | - * |
|
18 | - * @var string|array|Icon |
|
19 | - */ |
|
20 | - public $icon; |
|
15 | + /** |
|
16 | + * Icon that will appear on the button (top). |
|
17 | + * |
|
18 | + * @var string|array|Icon |
|
19 | + */ |
|
20 | + public $icon; |
|
21 | 21 | |
22 | - public $label; |
|
22 | + public $label; |
|
23 | 23 | |
24 | - public $element = 'a'; |
|
24 | + public $element = 'a'; |
|
25 | 25 | |
26 | - public $weight = 10; |
|
26 | + public $weight = 10; |
|
27 | 27 | |
28 | - public $callback; |
|
28 | + public $callback; |
|
29 | 29 | |
30 | - public function renderView() |
|
31 | - { |
|
32 | - $this->addIcon(); |
|
30 | + public function renderView() |
|
31 | + { |
|
32 | + $this->addIcon(); |
|
33 | 33 | |
34 | - $this->addLabel(); |
|
34 | + $this->addLabel(); |
|
35 | 35 | |
36 | - $this->addCallback(); |
|
36 | + $this->addCallback(); |
|
37 | 37 | |
38 | - parent::renderView(); |
|
39 | - } |
|
38 | + parent::renderView(); |
|
39 | + } |
|
40 | 40 | |
41 | - protected function addIcon() |
|
42 | - { |
|
43 | - if (! $icon = $this->getIcon()) return; |
|
41 | + protected function addIcon() |
|
42 | + { |
|
43 | + if (! $icon = $this->getIcon()) return; |
|
44 | 44 | |
45 | - $this->add($icon, 'Icon')->id = null; |
|
45 | + $this->add($icon, 'Icon')->id = null; |
|
46 | 46 | |
47 | - $this->addClass('icon'); |
|
47 | + $this->addClass('icon'); |
|
48 | 48 | |
49 | - return $this; |
|
50 | - } |
|
49 | + return $this; |
|
50 | + } |
|
51 | 51 | |
52 | - protected function addLabel() |
|
53 | - { |
|
54 | - $this->content = $this->label?: $this->content; |
|
52 | + protected function addLabel() |
|
53 | + { |
|
54 | + $this->content = $this->label?: $this->content; |
|
55 | 55 | |
56 | - return $this; |
|
57 | - } |
|
56 | + return $this; |
|
57 | + } |
|
58 | 58 | |
59 | - public function getIcon() |
|
60 | - { |
|
61 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
62 | - } |
|
59 | + public function getIcon() |
|
60 | + { |
|
61 | + return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
62 | + } |
|
63 | 63 | |
64 | - public function callback($callable) |
|
65 | - { |
|
66 | - $this->callback = $callable; |
|
64 | + public function callback($callable) |
|
65 | + { |
|
66 | + $this->callback = $callable; |
|
67 | 67 | |
68 | - return $this; |
|
69 | - } |
|
68 | + return $this; |
|
69 | + } |
|
70 | 70 | |
71 | - public function addCallback() |
|
72 | - { |
|
73 | - if (!$callable = $this->callback) return; |
|
71 | + public function addCallback() |
|
72 | + { |
|
73 | + if (!$callable = $this->callback) return; |
|
74 | 74 | |
75 | - if (is_callable($callable)) { |
|
76 | - $callable = $this->add('jsCallback')->set($callable); |
|
77 | - } |
|
75 | + if (is_callable($callable)) { |
|
76 | + $callable = $this->add('jsCallback')->set($callable); |
|
77 | + } |
|
78 | 78 | |
79 | - if ($callable instanceof jsCallback) { |
|
80 | - $this->on('click', $callable); |
|
81 | - } |
|
79 | + if ($callable instanceof jsCallback) { |
|
80 | + $this->on('click', $callable); |
|
81 | + } |
|
82 | 82 | |
83 | - return $this; |
|
84 | - } |
|
83 | + return $this; |
|
84 | + } |
|
85 | 85 | |
86 | 86 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | protected function addIcon() |
42 | 42 | { |
43 | - if (! $icon = $this->getIcon()) return; |
|
43 | + if (!$icon = $this->getIcon()) return; |
|
44 | 44 | |
45 | 45 | $this->add($icon, 'Icon')->id = null; |
46 | 46 | |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | |
52 | 52 | protected function addLabel() |
53 | 53 | { |
54 | - $this->content = $this->label?: $this->content; |
|
54 | + $this->content = $this->label ?: $this->content; |
|
55 | 55 | |
56 | 56 | return $this; |
57 | 57 | } |
58 | 58 | |
59 | 59 | public function getIcon() |
60 | 60 | { |
61 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
61 | + return is_object($this->icon) ? $this->icon : new Icon($this->icon); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function callback($callable) |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | protected function addIcon() |
42 | 42 | { |
43 | - if (! $icon = $this->getIcon()) return; |
|
43 | + if (! $icon = $this->getIcon()) { |
|
44 | + return; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | $this->add($icon, 'Icon')->id = null; |
46 | 48 | |
@@ -70,7 +72,9 @@ discard block |
||
70 | 72 | |
71 | 73 | public function addCallback() |
72 | 74 | { |
73 | - if (!$callable = $this->callback) return; |
|
75 | + if (!$callable = $this->callback) { |
|
76 | + return; |
|
77 | + } |
|
74 | 78 | |
75 | 79 | if (is_callable($callable)) { |
76 | 80 | $callable = $this->add('jsCallback')->set($callable); |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | { |
29 | 29 | $modules = ModuleManager::getAll(); |
30 | 30 | |
31 | - return $modules->filter(function ($subModuleClass) use ($modules) { |
|
32 | - return ! $modules->map(function($moduleClass){ |
|
31 | + return $modules->filter(function($subModuleClass) use ($modules) { |
|
32 | + return !$modules->map(function($moduleClass) { |
|
33 | 33 | return $moduleClass::namespace(); |
34 | 34 | })->contains($subModuleClass::parentNamespace()); |
35 | 35 | })->sort(); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $section->add($label, 'title')->setStyle('float', 'right'); |
62 | 62 | |
63 | - $submodules = ModuleManager::getAll()->filter(function ($subModuleClass) use ($moduleClass) { |
|
63 | + $submodules = ModuleManager::getAll()->filter(function($subModuleClass) use ($moduleClass) { |
|
64 | 64 | return $subModuleClass::isSubModuleOf($moduleClass); |
65 | 65 | }); |
66 | 66 | |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | public function formatModuleInfo($moduleClass) |
74 | 74 | { |
75 | - $moduleInfo = (array) ($moduleClass::info()?: __(' No details provided by author')); |
|
75 | + $moduleInfo = (array) ($moduleClass::info() ?: __(' No details provided by author')); |
|
76 | 76 | |
77 | 77 | $ret = []; |
78 | 78 | foreach ($moduleInfo as $label => $text) { |
79 | - $ret[] = (is_string($label)? "<strong>$label</strong>: ": '') . $text; |
|
79 | + $ret[] = (is_string($label) ? "<strong>$label</strong>: " : '') . $text; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return implode('<br>', $ret); |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | |
110 | 110 | $form = $view->add(new Form()); |
111 | 111 | foreach ($recommended as $childModule) { |
112 | - if (! ModuleManager::isAvailable($childModule)) continue; |
|
112 | + if (!ModuleManager::isAvailable($childModule)) continue; |
|
113 | 113 | |
114 | 114 | $form->addField($childModule::alias(), ['CheckBox', 'caption' => $childModule::label()]); |
115 | 115 | } |
116 | 116 | |
117 | - $form->onSubmit(function ($form) use ($moduleClass) { |
|
117 | + $form->onSubmit(function($form) use ($moduleClass) { |
|
118 | 118 | ob_start(); |
119 | 119 | ModuleManager::install($moduleClass, array_keys($form->getValues(), true)); |
120 | 120 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | $view->add(['Button', __('Install'), 'primary'])->on('click', [ |
126 | - isset($form)? $form->submit(): $installCallback |
|
126 | + isset($form) ? $form->submit() : $installCallback |
|
127 | 127 | ]); |
128 | 128 | }); |
129 | 129 |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | $this->addUninstallButton($section, $moduleClass); |
52 | 52 | |
53 | 53 | // $this->addReinstallButton($section, $moduleClass); |
54 | - } |
|
55 | - else { |
|
54 | + } else { |
|
56 | 55 | $label = ['Label', __('Available'), 'yellow']; |
57 | 56 | |
58 | 57 | $this->addInstallButton($section, $moduleClass); |
@@ -64,7 +63,9 @@ discard block |
||
64 | 63 | return $subModuleClass::isSubModuleOf($moduleClass); |
65 | 64 | }); |
66 | 65 | |
67 | - if ($submodules->isEmpty()) continue; |
|
66 | + if ($submodules->isEmpty()) { |
|
67 | + continue; |
|
68 | + } |
|
68 | 69 | |
69 | 70 | $this->addAccordion($section, $submodules); |
70 | 71 | } |
@@ -109,7 +110,9 @@ discard block |
||
109 | 110 | |
110 | 111 | $form = $view->add(new Form()); |
111 | 112 | foreach ($recommended as $childModule) { |
112 | - if (! ModuleManager::isAvailable($childModule)) continue; |
|
113 | + if (! ModuleManager::isAvailable($childModule)) { |
|
114 | + continue; |
|
115 | + } |
|
113 | 116 | |
114 | 117 | $form->addField($childModule::alias(), ['CheckBox', 'caption' => $childModule::label()]); |
115 | 118 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $accordion = $container->add(['Accordion', 'type' => ['styled', 'fluid'], 'settings' => ['animateChildren' => false]])->setStyle(['max-width' => '800px', 'margin-left' => 'auto', 'margin-right' => 'auto']); |
44 | 44 | |
45 | 45 | if ($container == $this) { |
46 | - $this->accordion = $accordion; |
|
46 | + $this->accordion = $accordion; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | foreach ($modules as $moduleClass) { |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | |
93 | 93 | public function addInstallButton($container, $moduleClass) |
94 | 94 | { |
95 | - $button = $container->add(['Button', __('Install'), 'class' => ['green']]); |
|
95 | + $button = $container->add(['Button', __('Install'), 'class' => ['green']]); |
|
96 | 96 | |
97 | - $callback = $installCallback = $this->add('jsCallback')->set(function() use ($moduleClass, $container) { |
|
97 | + $callback = $installCallback = $this->add('jsCallback')->set(function() use ($moduleClass, $container) { |
|
98 | 98 | ob_start(); |
99 | 99 | ModuleManager::install($moduleClass); |
100 | 100 | |
101 | 101 | $message = ob_get_clean(); |
102 | 102 | |
103 | 103 | return [ |
104 | - $this->notifySuccess($message), |
|
105 | - new jsReload($this->accordion), |
|
104 | + $this->notifySuccess($message), |
|
105 | + new jsReload($this->accordion), |
|
106 | 106 | ]; |
107 | 107 | }); |
108 | 108 | |
@@ -150,17 +150,17 @@ discard block |
||
150 | 150 | |
151 | 151 | public function addUninstallButton($container, $moduleClass) |
152 | 152 | { |
153 | - $button = $container->add(['Button', __('Uninstall'), 'class' => ['red']]); |
|
153 | + $button = $container->add(['Button', __('Uninstall'), 'class' => ['red']]); |
|
154 | 154 | |
155 | - $callback = $uninstallCallback = $button->add(['jsCallback', 'confirm' => __('Are you sure you want to uninstall :module', ['module' => $moduleClass::label()])])->set(function() use ($moduleClass) { |
|
156 | - ob_start(); |
|
155 | + $callback = $uninstallCallback = $button->add(['jsCallback', 'confirm' => __('Are you sure you want to uninstall :module', ['module' => $moduleClass::label()])])->set(function() use ($moduleClass) { |
|
156 | + ob_start(); |
|
157 | 157 | ModuleManager::uninstall($moduleClass); |
158 | 158 | |
159 | 159 | $message = ob_get_clean(); |
160 | 160 | |
161 | 161 | return [ |
162 | - $this->notifySuccess($message), |
|
163 | - new jsReload($this->accordion), |
|
162 | + $this->notifySuccess($message), |
|
163 | + new jsReload($this->accordion), |
|
164 | 164 | ]; |
165 | 165 | }); |
166 | 166 | |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | |
196 | 196 | public function addClearCacheButton() |
197 | 197 | { |
198 | - ActionBar::addItemButton([__('Clear Cache'), 'icon' => 'refresh', 'hint' => __('Clears module cache and re-discovers all available modules')])->callback(function($callback) { |
|
198 | + ActionBar::addItemButton([__('Clear Cache'), 'icon' => 'refresh', 'hint' => __('Clears module cache and re-discovers all available modules')])->callback(function($callback) { |
|
199 | 199 | ModuleManager::clearCache(); |
200 | 200 | |
201 | 201 | return [ |
202 | - new jsReload($this->accordion), |
|
203 | - $this->notifySuccess(__('Cache cleared!')) |
|
202 | + new jsReload($this->accordion), |
|
203 | + $this->notifySuccess(__('Cache cleared!')) |
|
204 | 204 | ]; |
205 | 205 | }); |
206 | 206 | } |
@@ -7,17 +7,17 @@ |
||
7 | 7 | |
8 | 8 | class SQL extends \atk4\data\Persistence\SQL |
9 | 9 | { |
10 | - /** |
|
11 | - * Take a laravel connection and pass it to ATK Data |
|
12 | - * |
|
13 | - * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager |
|
14 | - * |
|
15 | - * @return \atk4\data\Persistence_SQL |
|
16 | - * @throws \atk4\data\Exception |
|
17 | - * @throws \atk4\dsql\Exception |
|
18 | - */ |
|
19 | - public function __construct(DatabaseManager $database) |
|
20 | - { |
|
21 | - parent::__construct(Connection::connect($database->connection()->getPdo())); |
|
22 | - } |
|
10 | + /** |
|
11 | + * Take a laravel connection and pass it to ATK Data |
|
12 | + * |
|
13 | + * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager |
|
14 | + * |
|
15 | + * @return \atk4\data\Persistence_SQL |
|
16 | + * @throws \atk4\data\Exception |
|
17 | + * @throws \atk4\dsql\Exception |
|
18 | + */ |
|
19 | + public function __construct(DatabaseManager $database) |
|
20 | + { |
|
21 | + parent::__construct(Connection::connect($database->connection()->getPdo())); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -4,14 +4,14 @@ |
||
4 | 4 | |
5 | 5 | class Utils |
6 | 6 | { |
7 | - public static function bytesToHuman($bytes) |
|
8 | - { |
|
9 | - $units = [__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB')]; |
|
7 | + public static function bytesToHuman($bytes) |
|
8 | + { |
|
9 | + $units = [__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB')]; |
|
10 | 10 | |
11 | - for ($i = 0; $bytes > 1024; $i++) { |
|
12 | - $bytes /= 1024; |
|
13 | - } |
|
11 | + for ($i = 0; $bytes > 1024; $i++) { |
|
12 | + $bytes /= 1024; |
|
13 | + } |
|
14 | 14 | |
15 | - return round($bytes, 2) . ' ' . $units[$i]; |
|
16 | - } |
|
15 | + return round($bytes, 2) . ' ' . $units[$i]; |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | $this->app->singleton( |
59 | 59 | SQL::class, |
60 | - function ($app) { |
|
60 | + function($app) { |
|
61 | 61 | /** |
62 | 62 | * Database Manager |
63 | 63 | * |
@@ -12,73 +12,73 @@ |
||
12 | 12 | |
13 | 13 | class EpesiServiceProvider extends ServiceProvider |
14 | 14 | { |
15 | - /** |
|
16 | - * Booting the package. |
|
17 | - */ |
|
18 | - public function boot() |
|
19 | - { |
|
20 | - $this->ensureHttps(); |
|
15 | + /** |
|
16 | + * Booting the package. |
|
17 | + */ |
|
18 | + public function boot() |
|
19 | + { |
|
20 | + $this->ensureHttps(); |
|
21 | 21 | |
22 | - if (env('APP_DEBUG', false)) ModuleManager::clearCache(); |
|
22 | + if (env('APP_DEBUG', false)) ModuleManager::clearCache(); |
|
23 | 23 | |
24 | - Route::group(['namespace' => 'Epesi\Core', 'middleware' => 'web'], function() { |
|
25 | - Route::any('/', 'Controller@index'); |
|
26 | - Route::get('logo', 'Controller@logo'); |
|
27 | - Route::any('install', 'Controller@install'); |
|
24 | + Route::group(['namespace' => 'Epesi\Core', 'middleware' => 'web'], function() { |
|
25 | + Route::any('/', 'Controller@index'); |
|
26 | + Route::get('logo', 'Controller@logo'); |
|
27 | + Route::any('install', 'Controller@install'); |
|
28 | 28 | |
29 | - Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() { |
|
30 | - Route::any('home', 'Controller@home')->name('home'); |
|
29 | + Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() { |
|
30 | + Route::any('home', 'Controller@home')->name('home'); |
|
31 | 31 | |
32 | - Route::any('view/{alias}/{method?}/{args?}', 'Controller@view'); |
|
33 | - }); |
|
34 | - }); |
|
32 | + Route::any('view/{alias}/{method?}/{args?}', 'Controller@view'); |
|
33 | + }); |
|
34 | + }); |
|
35 | 35 | |
36 | - // call boot methods on all modules |
|
37 | - ModuleManager::call('boot'); |
|
36 | + // call boot methods on all modules |
|
37 | + ModuleManager::call('boot'); |
|
38 | 38 | |
39 | 39 | foreach (ModuleManager::collect('translations') as $path) { |
40 | 40 | $this->loadJsonTranslationsFrom($path); |
41 | 41 | } |
42 | 42 | |
43 | - // Register admin service provider if in admin mode or in console |
|
44 | - // TODO: apply access restriction to admin mode |
|
43 | + // Register admin service provider if in admin mode or in console |
|
44 | + // TODO: apply access restriction to admin mode |
|
45 | 45 | // if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) { |
46 | - if ($this->app->runningInConsole() || request('admin', false)) { |
|
47 | - $this->app->register(AdminServiceProvider::class); |
|
48 | - } |
|
49 | - } |
|
46 | + if ($this->app->runningInConsole() || request('admin', false)) { |
|
47 | + $this->app->register(AdminServiceProvider::class); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Register the provider. |
|
53 | - */ |
|
54 | - public function register() |
|
55 | - { |
|
56 | - $this->app->singleton(UI::class); |
|
51 | + /** |
|
52 | + * Register the provider. |
|
53 | + */ |
|
54 | + public function register() |
|
55 | + { |
|
56 | + $this->app->singleton(UI::class); |
|
57 | 57 | |
58 | - $this->app->singleton( |
|
59 | - SQL::class, |
|
60 | - function ($app) { |
|
61 | - /** |
|
62 | - * Database Manager |
|
63 | - * |
|
64 | - * @var \Illuminate\Database\DatabaseManager $db |
|
65 | - */ |
|
66 | - $db = DB::getFacadeRoot(); |
|
58 | + $this->app->singleton( |
|
59 | + SQL::class, |
|
60 | + function ($app) { |
|
61 | + /** |
|
62 | + * Database Manager |
|
63 | + * |
|
64 | + * @var \Illuminate\Database\DatabaseManager $db |
|
65 | + */ |
|
66 | + $db = DB::getFacadeRoot(); |
|
67 | 67 | |
68 | - return new SQL($db); |
|
69 | - }); |
|
70 | - } |
|
68 | + return new SQL($db); |
|
69 | + }); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Force to set https scheme if https enabled. |
|
74 | - * |
|
75 | - * @return void |
|
76 | - */ |
|
77 | - protected function ensureHttps() |
|
78 | - { |
|
79 | - if (config('epesi.https') || config('epesi.secure')) { |
|
80 | - url()->forceScheme('https'); |
|
81 | - $this->app['request']->server->set('HTTPS', true); |
|
82 | - } |
|
83 | - } |
|
72 | + /** |
|
73 | + * Force to set https scheme if https enabled. |
|
74 | + * |
|
75 | + * @return void |
|
76 | + */ |
|
77 | + protected function ensureHttps() |
|
78 | + { |
|
79 | + if (config('epesi.https') || config('epesi.secure')) { |
|
80 | + url()->forceScheme('https'); |
|
81 | + $this->app['request']->server->set('HTTPS', true); |
|
82 | + } |
|
83 | + } |
|
84 | 84 | } |
@@ -19,7 +19,9 @@ |
||
19 | 19 | { |
20 | 20 | $this->ensureHttps(); |
21 | 21 | |
22 | - if (env('APP_DEBUG', false)) ModuleManager::clearCache(); |
|
22 | + if (env('APP_DEBUG', false)) { |
|
23 | + ModuleManager::clearCache(); |
|
24 | + } |
|
23 | 25 | |
24 | 26 | Route::group(['namespace' => 'Epesi\Core', 'middleware' => 'web'], function() { |
25 | 27 | Route::any('/', 'Controller@index'); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function showEditPermissions() |
37 | 37 | { |
38 | - $permissionsData = Permission::all(['id', 'name'])->map(function($permission){ |
|
38 | + $permissionsData = Permission::all(['id', 'name'])->map(function($permission) { |
|
39 | 39 | $permission['name'] = trans(ucwords($permission['name'])); |
40 | 40 | |
41 | 41 | return $permission; |
@@ -99,19 +99,19 @@ discard block |
||
99 | 99 | |
100 | 100 | protected function columns() |
101 | 101 | { |
102 | - return $this->columns = $this->columns?: $this->add('Columns'); |
|
102 | + return $this->columns = $this->columns ?: $this->add('Columns'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | protected function permissionId() |
106 | 106 | { |
107 | - return $this->app->stickyGet($this->columns()->name)?: $this->getModuleVariable('permission'); |
|
107 | + return $this->app->stickyGet($this->columns()->name) ?: $this->getModuleVariable('permission'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | protected function reload($permissionExpression = null) |
111 | 111 | { |
112 | 112 | $columns = $this->columns(); |
113 | 113 | |
114 | - return $this->reload = $this->reload?: new jsReload($columns, [$columns->name => $permissionExpression?: '']); |
|
114 | + return $this->reload = $this->reload ?: new jsReload($columns, [$columns->name => $permissionExpression ?: '']); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | protected function getModel($array) |
@@ -8,28 +8,28 @@ |
||
8 | 8 | |
9 | 9 | class ModuleManagerTest extends TestCase |
10 | 10 | { |
11 | - /** |
|
12 | - * Setup the test environment. |
|
13 | - */ |
|
14 | - protected function setUp(): void |
|
15 | - { |
|
16 | - parent::setUp(); |
|
11 | + /** |
|
12 | + * Setup the test environment. |
|
13 | + */ |
|
14 | + protected function setUp(): void |
|
15 | + { |
|
16 | + parent::setUp(); |
|
17 | 17 | |
18 | - config([ |
|
19 | - 'epesi.modules' => [ |
|
20 | - '\\Epesi\\Core\\' => __DIR__ . implode(DIRECTORY_SEPARATOR, ['..', '..', 'src']), |
|
21 | - ] |
|
22 | - ]); |
|
18 | + config([ |
|
19 | + 'epesi.modules' => [ |
|
20 | + '\\Epesi\\Core\\' => __DIR__ . implode(DIRECTORY_SEPARATOR, ['..', '..', 'src']), |
|
21 | + ] |
|
22 | + ]); |
|
23 | 23 | |
24 | - ModuleManager::install('system'); |
|
25 | - } |
|
24 | + ModuleManager::install('system'); |
|
25 | + } |
|
26 | 26 | |
27 | - public function testContentStorage() |
|
28 | - { |
|
29 | - $installedModules = ModuleManager::getInstalled(); |
|
27 | + public function testContentStorage() |
|
28 | + { |
|
29 | + $installedModules = ModuleManager::getInstalled(); |
|
30 | 30 | |
31 | - $this->assertArrayHasKey('system', $installedModules, 'System module not installed'); |
|
32 | - } |
|
31 | + $this->assertArrayHasKey('system', $installedModules, 'System module not installed'); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | 35 | } |
36 | 36 | \ No newline at end of file |