@@ -2,35 +2,35 @@ |
||
2 | 2 | |
3 | 3 | if (! function_exists('epesi')) { |
4 | 4 | function ui() : Epesi\Core\UI |
5 | - { |
|
6 | - return resolve(Epesi\Core\UI::class); |
|
7 | - } |
|
5 | + { |
|
6 | + return resolve(Epesi\Core\UI::class); |
|
7 | + } |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | if (! function_exists('eval_css')) { |
11 | 11 | function eval_css($css) |
12 | - { |
|
13 | - ui()->addStyle($css); |
|
14 | - } |
|
12 | + { |
|
13 | + ui()->addStyle($css); |
|
14 | + } |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | if (! function_exists('eval_js')) { |
18 | 18 | function eval_js($js, $args = []) |
19 | - { |
|
20 | - ui()->addJS($js, $args); |
|
21 | - } |
|
19 | + { |
|
20 | + ui()->addJS($js, $args); |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if (! function_exists('load_css')) { |
25 | 25 | function load_css($url) |
26 | - { |
|
27 | - return ui()->requireCSS($url); |
|
28 | - } |
|
26 | + { |
|
27 | + return ui()->requireCSS($url); |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (! function_exists('load_js')) { |
32 | 32 | function load_js($url) |
33 | - { |
|
34 | - return ui()->requireJS($url); |
|
35 | - } |
|
33 | + { |
|
34 | + return ui()->requireJS($url); |
|
35 | + } |
|
36 | 36 | } |
@@ -1,34 +1,34 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('epesi')) { |
|
3 | +if (!function_exists('epesi')) { |
|
4 | 4 | function ui() : Epesi\Core\UI |
5 | 5 | { |
6 | 6 | return resolve(Epesi\Core\UI::class); |
7 | 7 | } |
8 | 8 | } |
9 | 9 | |
10 | -if (! function_exists('eval_css')) { |
|
10 | +if (!function_exists('eval_css')) { |
|
11 | 11 | function eval_css($css) |
12 | 12 | { |
13 | 13 | ui()->addStyle($css); |
14 | 14 | } |
15 | 15 | } |
16 | 16 | |
17 | -if (! function_exists('eval_js')) { |
|
17 | +if (!function_exists('eval_js')) { |
|
18 | 18 | function eval_js($js, $args = []) |
19 | 19 | { |
20 | 20 | ui()->addJS($js, $args); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | -if (! function_exists('load_css')) { |
|
24 | +if (!function_exists('load_css')) { |
|
25 | 25 | function load_css($url) |
26 | 26 | { |
27 | 27 | return ui()->requireCSS($url); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -if (! function_exists('load_js')) { |
|
31 | +if (!function_exists('load_js')) { |
|
32 | 32 | function load_js($url) |
33 | 33 | { |
34 | 34 | return ui()->requireJS($url); |
@@ -30,36 +30,36 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class LayoutView extends ModuleView |
32 | 32 | { |
33 | - public $menuLeft; // vertical menu |
|
34 | - public $menu; // horizontal menu |
|
35 | - public $menuRight; // vertical pull-down |
|
36 | - public $actionBar; |
|
37 | - public $locationBar; |
|
33 | + public $menuLeft; // vertical menu |
|
34 | + public $menu; // horizontal menu |
|
35 | + public $menuRight; // vertical pull-down |
|
36 | + public $actionBar; |
|
37 | + public $locationBar; |
|
38 | 38 | |
39 | - public $burger = true; // burger menu item |
|
39 | + public $burger = true; // burger menu item |
|
40 | 40 | |
41 | - /* |
|
41 | + /* |
|
42 | 42 | * Whether or not left Menu is visible on Page load. |
43 | 43 | */ |
44 | - public $isMenuLeftVisible = true; |
|
44 | + public $isMenuLeftVisible = true; |
|
45 | 45 | |
46 | - public $defaultTemplate = 'layout/admin.html'; |
|
46 | + public $defaultTemplate = 'layout/admin.html'; |
|
47 | 47 | |
48 | - protected $location; |
|
48 | + protected $location; |
|
49 | 49 | |
50 | - public function init() |
|
51 | - { |
|
52 | - parent::init(); |
|
50 | + public function init() |
|
51 | + { |
|
52 | + parent::init(); |
|
53 | 53 | |
54 | - $this->setMenu(); |
|
55 | - $this->setActionBar(); |
|
54 | + $this->setMenu(); |
|
55 | + $this->setActionBar(); |
|
56 | 56 | |
57 | 57 | // if (request()->pjax()) return; |
58 | 58 | |
59 | - $this->setMenuLeft(); |
|
60 | - $this->setMenuRight(); |
|
59 | + $this->setMenuLeft(); |
|
60 | + $this->setMenuRight(); |
|
61 | 61 | |
62 | - $this->setVersion(); |
|
62 | + $this->setVersion(); |
|
63 | 63 | |
64 | 64 | // $this->js(true, null, 'body')->niceScroll(); |
65 | 65 | |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | // if (event.originalEvent.persisted) { |
69 | 69 | // window.location.reload(); |
70 | 70 | // }')])); |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - public function setMenu() |
|
74 | - { |
|
75 | - if ($this->menu) return; |
|
73 | + public function setMenu() |
|
74 | + { |
|
75 | + if ($this->menu) return; |
|
76 | 76 | |
77 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
77 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
78 | 78 | |
79 | - // company logo |
|
80 | - // see \Epesi\Core\Controller::logo |
|
81 | - $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
79 | + // company logo |
|
80 | + // see \Epesi\Core\Controller::logo |
|
81 | + $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
82 | 82 | |
83 | - if ($this->burger) { |
|
84 | - /** @scrutinizer ignore-call */ |
|
85 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | - } |
|
83 | + if ($this->burger) { |
|
84 | + /** @scrutinizer ignore-call */ |
|
85 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | // home icon redirects to /home path |
89 | 89 | // see \Epesi\Core\Controller::home |
90 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
90 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
91 | 91 | |
92 | 92 | // location bar |
93 | 93 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -130,50 +130,50 @@ discard block |
||
130 | 130 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
131 | 131 | } |
132 | 132 | |
133 | - public function setMenuLeft() |
|
134 | - { |
|
135 | - if ($this->menuLeft) return; |
|
133 | + public function setMenuLeft() |
|
134 | + { |
|
135 | + if ($this->menuLeft) return; |
|
136 | 136 | |
137 | - $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
137 | + $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
138 | 138 | |
139 | - if (! $this->burger) return; |
|
139 | + if (! $this->burger) return; |
|
140 | 140 | |
141 | - if (! session()->get('menu', 1)) { |
|
142 | - $this->isMenuLeftVisible = false; |
|
143 | - } |
|
141 | + if (! session()->get('menu', 1)) { |
|
142 | + $this->isMenuLeftVisible = false; |
|
143 | + } |
|
144 | 144 | |
145 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
147 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
148 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
149 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
150 | - session()->put('menu', $visible? 1: 0); |
|
151 | - session()->save(); |
|
152 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
153 | - ]); |
|
154 | - } |
|
145 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
147 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
148 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
149 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
150 | + session()->put('menu', $visible? 1: 0); |
|
151 | + session()->save(); |
|
152 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
153 | + ]); |
|
154 | + } |
|
155 | 155 | |
156 | - public function setActionBar() |
|
157 | - { |
|
158 | - if ($this->actionBar) return; |
|
156 | + public function setActionBar() |
|
157 | + { |
|
158 | + if ($this->actionBar) return; |
|
159 | 159 | |
160 | - $this->actionBar = $this->add(Seeds\ActionBar::class, 'ActionBar'); |
|
161 | - } |
|
160 | + $this->actionBar = $this->add(Seeds\ActionBar::class, 'ActionBar'); |
|
161 | + } |
|
162 | 162 | |
163 | - public function setVersion() |
|
164 | - { |
|
165 | - $this->template->trySet('version', $this->app->version); |
|
166 | - } |
|
163 | + public function setVersion() |
|
164 | + { |
|
165 | + $this->template->trySet('version', $this->app->version); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * {@inheritdoc} |
|
170 | - */ |
|
168 | + /** |
|
169 | + * {@inheritdoc} |
|
170 | + */ |
|
171 | 171 | |
172 | - public function renderView() |
|
173 | - { |
|
174 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
175 | - $this->menuLeft->addClass('visible'); |
|
176 | - } |
|
177 | - parent::renderView(); |
|
178 | - } |
|
172 | + public function renderView() |
|
173 | + { |
|
174 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
175 | + $this->menuLeft->addClass('visible'); |
|
176 | + } |
|
177 | + parent::renderView(); |
|
178 | + } |
|
179 | 179 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $this->addHeader($this->app->title); |
18 | 18 | |
19 | 19 | $items = collect(); |
20 | - foreach(NavMenuJoint::collect() as $joint) { |
|
20 | + foreach (NavMenuJoint::collect() as $joint) { |
|
21 | 21 | $items = $items->merge($joint->items()); |
22 | 22 | } |
23 | 23 | |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | |
35 | 35 | public static function addItems($menu, Collection $items) |
36 | 36 | { |
37 | - $items->sort(function ($entry1, $entry2) { |
|
37 | + $items->sort(function($entry1, $entry2) { |
|
38 | 38 | $weight1 = $entry1['weight']?? 10; |
39 | 39 | $weight2 = $entry2['weight']?? 10; |
40 | 40 | |
41 | 41 | return $weight1 <=> $weight2; |
42 | 42 | })->map(function($entry, $caption) use ($menu) { |
43 | - if (! ($entry['access'] ?? true)) return; |
|
43 | + if (!($entry['access'] ?? true)) return; |
|
44 | 44 | |
45 | 45 | if (!is_array($entry)) { |
46 | 46 | $entry = ['action' => $entry]; |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | return $weight1 <=> $weight2; |
42 | 42 | })->map(function($entry, $caption) use ($menu) { |
43 | - if (! ($entry['access'] ?? true)) return; |
|
43 | + if (! ($entry['access'] ?? true)) { |
|
44 | + return; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | if (!is_array($entry)) { |
46 | 48 | $entry = ['action' => $entry]; |
@@ -56,13 +58,11 @@ discard block |
||
56 | 58 | $submenu = $menu->addMenu($entry['item']); |
57 | 59 | |
58 | 60 | self::addItems($submenu, collect($subitems)); |
59 | - } |
|
60 | - elseif ($subitems = $entry['group'] ?? []) { |
|
61 | + } elseif ($subitems = $entry['group'] ?? []) { |
|
61 | 62 | $subgroup = $menu->addGroup($entry['item']); |
62 | 63 | |
63 | 64 | self::addItems($subgroup, collect($subitems)); |
64 | - } |
|
65 | - else { |
|
65 | + } else { |
|
66 | 66 | $menu->addItem($entry['item'], $entry['action'] ?? ''); |
67 | 67 | } |
68 | 68 | }); |
@@ -10,66 +10,66 @@ |
||
10 | 10 | |
11 | 11 | class Controller extends BaseController |
12 | 12 | { |
13 | - public function index() |
|
14 | - { |
|
15 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | - } |
|
13 | + public function index() |
|
14 | + { |
|
15 | + return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | + } |
|
17 | 17 | |
18 | - public function install(UI $ui) |
|
19 | - { |
|
20 | - // make sure the installation information is fresh |
|
21 | - ModuleManager::clearCache(); |
|
18 | + public function install(UI $ui) |
|
19 | + { |
|
20 | + // make sure the installation information is fresh |
|
21 | + ModuleManager::clearCache(); |
|
22 | 22 | |
23 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
23 | + if (SystemCore::isInstalled()) return redirect('home'); |
|
24 | 24 | |
25 | - $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.app.title')]); |
|
25 | + $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.app.title')]); |
|
26 | 26 | |
27 | - $ui->initLayout('Centered'); |
|
27 | + $ui->initLayout('Centered'); |
|
28 | 28 | |
29 | - $ui->layout->set('logo', url('logo')); |
|
30 | - $ui->layout->template->setHTML('copyright', config('epesi.app.copyright')); |
|
29 | + $ui->layout->set('logo', url('logo')); |
|
30 | + $ui->layout->template->setHTML('copyright', config('epesi.app.copyright')); |
|
31 | 31 | |
32 | - $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
32 | + $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
33 | 33 | |
34 | - return $ui->response(); |
|
35 | - } |
|
34 | + return $ui->response(); |
|
35 | + } |
|
36 | 36 | |
37 | - public function home() |
|
38 | - { |
|
39 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
40 | - } |
|
37 | + public function home() |
|
38 | + { |
|
39 | + return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
40 | + } |
|
41 | 41 | |
42 | - public function logo() |
|
43 | - { |
|
44 | - $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
42 | + public function logo() |
|
43 | + { |
|
44 | + $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
45 | 45 | |
46 | - return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
47 | - } |
|
46 | + return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
47 | + } |
|
48 | 48 | |
49 | - public function view(UI $ui, $module, $method = 'body', $args = []) |
|
50 | - { |
|
51 | - $ui->initLayout(new LayoutView()); |
|
49 | + public function view(UI $ui, $module, $method = 'body', $args = []) |
|
50 | + { |
|
51 | + $ui->initLayout(new LayoutView()); |
|
52 | 52 | |
53 | - $alias = explode(':', $module); |
|
53 | + $alias = explode(':', $module); |
|
54 | 54 | |
55 | - $moduleAlias = $alias[0]; |
|
56 | - $viewAlias = $alias[1]?? null; |
|
55 | + $moduleAlias = $alias[0]; |
|
56 | + $viewAlias = $alias[1]?? null; |
|
57 | 57 | |
58 | - $view = null; |
|
59 | - if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
60 | - $viewClass = $module::view($viewAlias); |
|
58 | + $view = null; |
|
59 | + if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
60 | + $viewClass = $module::view($viewAlias); |
|
61 | 61 | |
62 | - if (class_exists($viewClass)) { |
|
63 | - $view = new $viewClass(); |
|
64 | - } |
|
65 | - } |
|
62 | + if (class_exists($viewClass)) { |
|
63 | + $view = new $viewClass(); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - if (! $view) abort(404); |
|
67 | + if (! $view) abort(404); |
|
68 | 68 | |
69 | - $ui->add($view)->displayModuleContent($method, $args); |
|
69 | + $ui->add($view)->displayModuleContent($method, $args); |
|
70 | 70 | |
71 | - $ui->setLocation($view->location()); |
|
71 | + $ui->setLocation($view->location()); |
|
72 | 72 | |
73 | - return $ui->response(); |
|
74 | - } |
|
73 | + return $ui->response(); |
|
74 | + } |
|
75 | 75 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | public function index() |
14 | 14 | { |
15 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
15 | + return SystemCore::isInstalled() ? redirect('home') : redirect('install'); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function install(UI $ui) |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function home() |
38 | 38 | { |
39 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
39 | + return redirect(SystemCore::isInstalled() ? \Epesi\Core\HomePage\Models\HomePage::pathOfUser() : 'install'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function logo() |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - if (! $view) abort(404); |
|
67 | + if (!$view) abort(404); |
|
68 | 68 | |
69 | 69 | $ui->add($view)->displayModuleContent($method, $args); |
70 | 70 |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | // make sure the installation information is fresh |
21 | 21 | ModuleManager::clearCache(); |
22 | 22 | |
23 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
23 | + if (SystemCore::isInstalled()) { |
|
24 | + return redirect('home'); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.app.title')]); |
26 | 28 | |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | } |
65 | 67 | } |
66 | 68 | |
67 | - if (! $view) abort(404); |
|
69 | + if (! $view) { |
|
70 | + abort(404); |
|
71 | + } |
|
68 | 72 | |
69 | 73 | $ui->add($view)->displayModuleContent($method, $args); |
70 | 74 |
@@ -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'); |
@@ -12,11 +12,11 @@ |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | final public static function requireJS($file = 'default.js', $isAsync = false, $isDefer = false) { |
15 | - return ui()->requireJS(self::assetUrl('js/'. $file), $isAsync, $isDefer); |
|
15 | + return ui()->requireJS(self::assetUrl('js/' . $file), $isAsync, $isDefer); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | final public static function requireCSS($file = 'default.css') { |
19 | - return ui()->requireCSS(self::assetUrl('css/'. $file)); |
|
19 | + return ui()->requireCSS(self::assetUrl('css/' . $file)); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -7,13 +7,13 @@ |
||
7 | 7 | |
8 | 8 | class UI extends Facade |
9 | 9 | { |
10 | - /** |
|
11 | - * Get the registered name of the component. |
|
12 | - * |
|
13 | - * @return string |
|
14 | - */ |
|
15 | - protected static function getFacadeAccessor() |
|
16 | - { |
|
17 | - return App::class; |
|
18 | - } |
|
10 | + /** |
|
11 | + * Get the registered name of the component. |
|
12 | + * |
|
13 | + * @return string |
|
14 | + */ |
|
15 | + protected static function getFacadeAccessor() |
|
16 | + { |
|
17 | + return App::class; |
|
18 | + } |
|
19 | 19 | } |