@@ -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 | // $this->js(true, null, new jsExpression('window'))->on('pageshow', new jsFunction(['event'], [ |
@@ -67,24 +67,24 @@ discard block |
||
| 67 | 67 | // if (event.originalEvent.persisted) { |
| 68 | 68 | // window.location.reload(); |
| 69 | 69 | // }')])); |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - public function setMenu() |
|
| 73 | - { |
|
| 74 | - if ($this->menu) return; |
|
| 72 | + public function setMenu() |
|
| 73 | + { |
|
| 74 | + if ($this->menu) return; |
|
| 75 | 75 | |
| 76 | - //.ui.sidebar, |
|
| 77 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
| 76 | + //.ui.sidebar, |
|
| 77 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
| 78 | 78 | |
| 79 | - $this->app->addStyle(''); |
|
| 79 | + $this->app->addStyle(''); |
|
| 80 | 80 | |
| 81 | - // company logo |
|
| 82 | - $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
| 81 | + // company logo |
|
| 82 | + $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
| 83 | 83 | |
| 84 | - if ($this->burger) { |
|
| 85 | - /** @scrutinizer ignore-call */ |
|
| 86 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
| 87 | - } |
|
| 84 | + if ($this->burger) { |
|
| 85 | + /** @scrutinizer ignore-call */ |
|
| 86 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | // home icon |
| 90 | 90 | $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
@@ -126,50 +126,50 @@ discard block |
||
| 126 | 126 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function setMenuLeft() |
|
| 130 | - { |
|
| 131 | - if ($this->menuLeft) return; |
|
| 129 | + public function setMenuLeft() |
|
| 130 | + { |
|
| 131 | + if ($this->menuLeft) return; |
|
| 132 | 132 | |
| 133 | - $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
| 133 | + $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
| 134 | 134 | |
| 135 | - if (! $this->burger) return; |
|
| 135 | + if (! $this->burger) return; |
|
| 136 | 136 | |
| 137 | - if (! session()->get('menu', 1)) { |
|
| 138 | - $this->isMenuLeftVisible = false; |
|
| 139 | - } |
|
| 137 | + if (! session()->get('menu', 1)) { |
|
| 138 | + $this->isMenuLeftVisible = false; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
| 142 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
| 143 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
| 144 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
| 145 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
| 146 | - session()->put('menu', $visible? 1: 0); |
|
| 147 | - session()->save(); |
|
| 148 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
| 149 | - ]); |
|
| 150 | - } |
|
| 141 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
| 142 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
| 143 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
| 144 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
| 145 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
| 146 | + session()->put('menu', $visible? 1: 0); |
|
| 147 | + session()->save(); |
|
| 148 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
| 149 | + ]); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - public function setActionBar() |
|
| 153 | - { |
|
| 154 | - if ($this->actionBar) return; |
|
| 152 | + public function setActionBar() |
|
| 153 | + { |
|
| 154 | + if ($this->actionBar) return; |
|
| 155 | 155 | |
| 156 | - $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
|
| 157 | - } |
|
| 156 | + $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - public function setVersion() |
|
| 160 | - { |
|
| 161 | - $this->template->trySet('version', $this->app->version); |
|
| 162 | - } |
|
| 159 | + public function setVersion() |
|
| 160 | + { |
|
| 161 | + $this->template->trySet('version', $this->app->version); |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * {@inheritdoc} |
|
| 166 | - */ |
|
| 164 | + /** |
|
| 165 | + * {@inheritdoc} |
|
| 166 | + */ |
|
| 167 | 167 | |
| 168 | - public function renderView() |
|
| 169 | - { |
|
| 170 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
| 171 | - $this->menuLeft->addClass('visible'); |
|
| 172 | - } |
|
| 173 | - parent::renderView(); |
|
| 174 | - } |
|
| 168 | + public function renderView() |
|
| 169 | + { |
|
| 170 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
| 171 | + $this->menuLeft->addClass('visible'); |
|
| 172 | + } |
|
| 173 | + parent::renderView(); |
|
| 174 | + } |
|
| 175 | 175 | } |
@@ -30,13 +30,13 @@ 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 |
|
| 33 | + public $menuLeft; // vertical menu |
|
| 34 | + public $menu; // horizontal menu |
|
| 35 | + public $menuRight; // vertical pull-down |
|
| 36 | 36 | public $actionBar; |
| 37 | 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. |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // home icon |
| 90 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
|
| 90 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
|
| 91 | 91 | |
| 92 | 92 | // location bar |
| 93 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
| 93 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function setLocation($crumbs) |
@@ -132,20 +132,20 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
| 134 | 134 | |
| 135 | - if (! $this->burger) return; |
|
| 135 | + if (!$this->burger) return; |
|
| 136 | 136 | |
| 137 | - if (! session()->get('menu', 1)) { |
|
| 137 | + if (!session()->get('menu', 1)) { |
|
| 138 | 138 | $this->isMenuLeftVisible = false; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
| 141 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
| 142 | 142 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
| 143 | 143 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
| 144 | 144 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
| 145 | 145 | $this->burger->add('jsCallback')->set(function($j, $visible) { |
| 146 | - session()->put('menu', $visible? 1: 0); |
|
| 146 | + session()->put('menu', $visible ? 1 : 0); |
|
| 147 | 147 | session()->save(); |
| 148 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
| 148 | + }, [new \atk4\ui\jsExpression('$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0')]) |
|
| 149 | 149 | ]); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -71,7 +71,9 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function setMenu() |
| 73 | 73 | { |
| 74 | - if ($this->menu) return; |
|
| 74 | + if ($this->menu) { |
|
| 75 | + return; |
|
| 76 | + } |
|
| 75 | 77 | |
| 76 | 78 | //.ui.sidebar, |
| 77 | 79 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
@@ -119,7 +121,9 @@ discard block |
||
| 119 | 121 | |
| 120 | 122 | public function setMenuRight() |
| 121 | 123 | { |
| 122 | - if ($this->menuRight) return; |
|
| 124 | + if ($this->menuRight) { |
|
| 125 | + return; |
|
| 126 | + } |
|
| 123 | 127 | |
| 124 | 128 | $this->menuRight = $this->menu->add(new Seeds\RightMenu([ |
| 125 | 129 | 'ui' => false |
@@ -128,11 +132,15 @@ discard block |
||
| 128 | 132 | |
| 129 | 133 | public function setMenuLeft() |
| 130 | 134 | { |
| 131 | - if ($this->menuLeft) return; |
|
| 135 | + if ($this->menuLeft) { |
|
| 136 | + return; |
|
| 137 | + } |
|
| 132 | 138 | |
| 133 | 139 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
| 134 | 140 | |
| 135 | - if (! $this->burger) return; |
|
| 141 | + if (! $this->burger) { |
|
| 142 | + return; |
|
| 143 | + } |
|
| 136 | 144 | |
| 137 | 145 | if (! session()->get('menu', 1)) { |
| 138 | 146 | $this->isMenuLeftVisible = false; |
@@ -151,7 +159,9 @@ discard block |
||
| 151 | 159 | |
| 152 | 160 | public function setActionBar() |
| 153 | 161 | { |
| 154 | - if ($this->actionBar) return; |
|
| 162 | + if ($this->actionBar) { |
|
| 163 | + return; |
|
| 164 | + } |
|
| 155 | 165 | |
| 156 | 166 | $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
| 157 | 167 | } |
@@ -6,48 +6,48 @@ |
||
| 6 | 6 | |
| 7 | 7 | class SetEnvCommand extends Command |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * The name and signature of the console command. |
|
| 11 | - * |
|
| 12 | - * @var string |
|
| 13 | - */ |
|
| 14 | - protected $signature = 'epesi:env {name : Env variable(s) to set} {value? : Env variable value}'; |
|
| 9 | + /** |
|
| 10 | + * The name and signature of the console command. |
|
| 11 | + * |
|
| 12 | + * @var string |
|
| 13 | + */ |
|
| 14 | + protected $signature = 'epesi:env {name : Env variable(s) to set} {value? : Env variable value}'; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * The console command description. |
|
| 18 | - * |
|
| 19 | - * @var string |
|
| 20 | - */ |
|
| 21 | - protected $description = 'Update ENV variable'; |
|
| 16 | + /** |
|
| 17 | + * The console command description. |
|
| 18 | + * |
|
| 19 | + * @var string |
|
| 20 | + */ |
|
| 21 | + protected $description = 'Update ENV variable'; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Execute the console command. |
|
| 25 | - */ |
|
| 26 | - public function handle() |
|
| 27 | - { |
|
| 28 | - $this->setEnv($this->argument('name'), $this->argument('value')); |
|
| 29 | - } |
|
| 23 | + /** |
|
| 24 | + * Execute the console command. |
|
| 25 | + */ |
|
| 26 | + public function handle() |
|
| 27 | + { |
|
| 28 | + $this->setEnv($this->argument('name'), $this->argument('value')); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - private static function setEnv($name, $value = null) |
|
| 32 | - { |
|
| 33 | - $env = $name; |
|
| 34 | - if (is_string($name) && !isset($value)) { |
|
| 35 | - $env = [ |
|
| 36 | - $name => $value |
|
| 37 | - ]; |
|
| 38 | - } |
|
| 31 | + private static function setEnv($name, $value = null) |
|
| 32 | + { |
|
| 33 | + $env = $name; |
|
| 34 | + if (is_string($name) && !isset($value)) { |
|
| 35 | + $env = [ |
|
| 36 | + $name => $value |
|
| 37 | + ]; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - foreach ($env as $key => $value) { |
|
| 41 | - $oldSetting = $key . '=' . env($key); |
|
| 42 | - $newSetting = $key . '=' . $value; |
|
| 40 | + foreach ($env as $key => $value) { |
|
| 41 | + $oldSetting = $key . '=' . env($key); |
|
| 42 | + $newSetting = $key . '=' . $value; |
|
| 43 | 43 | |
| 44 | - putenv($newSetting); |
|
| 44 | + putenv($newSetting); |
|
| 45 | 45 | |
| 46 | - file_put_contents(app()->environmentFilePath(), str_replace( |
|
| 47 | - $oldSetting, |
|
| 48 | - $newSetting, |
|
| 49 | - file_get_contents(app()->environmentFilePath()) |
|
| 50 | - )); |
|
| 51 | - } |
|
| 52 | - } |
|
| 46 | + file_put_contents(app()->environmentFilePath(), str_replace( |
|
| 47 | + $oldSetting, |
|
| 48 | + $newSetting, |
|
| 49 | + file_get_contents(app()->environmentFilePath()) |
|
| 50 | + )); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -6,37 +6,37 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateCoreTables extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - $this->down(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + $this->down(); |
|
| 17 | 17 | |
| 18 | - Schema::create('variables', function (Blueprint $table) { |
|
| 19 | - $table->string('name', 128)->primary(); |
|
| 20 | - $table->text('value'); |
|
| 21 | - }); |
|
| 18 | + Schema::create('variables', function (Blueprint $table) { |
|
| 19 | + $table->string('name', 128)->primary(); |
|
| 20 | + $table->text('value'); |
|
| 21 | + }); |
|
| 22 | 22 | |
| 23 | - Schema::create('modules', function (Blueprint $table) { |
|
| 24 | - $table->string('class', 512); |
|
| 25 | - $table->string('alias', 128)->unique(); |
|
| 26 | - $table->smallInteger('priority')->default(0); |
|
| 27 | - $table->smallInteger('state')->default(1); |
|
| 28 | - }); |
|
| 29 | - } |
|
| 23 | + Schema::create('modules', function (Blueprint $table) { |
|
| 24 | + $table->string('class', 512); |
|
| 25 | + $table->string('alias', 128)->unique(); |
|
| 26 | + $table->smallInteger('priority')->default(0); |
|
| 27 | + $table->smallInteger('state')->default(1); |
|
| 28 | + }); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Reverse the migrations. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function down() |
|
| 37 | - { |
|
| 38 | - Schema::dropIfExists('variables'); |
|
| 31 | + /** |
|
| 32 | + * Reverse the migrations. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function down() |
|
| 37 | + { |
|
| 38 | + Schema::dropIfExists('variables'); |
|
| 39 | 39 | |
| 40 | - Schema::dropIfExists('modules'); |
|
| 41 | - } |
|
| 40 | + Schema::dropIfExists('modules'); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $this->down(); |
| 17 | 17 | |
| 18 | - Schema::create('variables', function (Blueprint $table) { |
|
| 18 | + Schema::create('variables', function(Blueprint $table) { |
|
| 19 | 19 | $table->string('name', 128)->primary(); |
| 20 | 20 | $table->text('value'); |
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | - Schema::create('modules', function (Blueprint $table) { |
|
| 23 | + Schema::create('modules', function(Blueprint $table) { |
|
| 24 | 24 | $table->string('class', 512); |
| 25 | 25 | $table->string('alias', 128)->unique(); |
| 26 | 26 | $table->smallInteger('priority')->default(0); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $paths = $this->migrations(); |
| 22 | 22 | |
| 23 | - foreach (is_array($paths)? $paths: [$paths] as $path) { |
|
| 23 | + foreach (is_array($paths) ? $paths : [$paths] as $path) { |
|
| 24 | 24 | \Illuminate\Support\Facades\Artisan::call('migrate', ['--path' => $path, '--force' => true]); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $paths = $this->migrations(); |
| 33 | 33 | |
| 34 | - foreach (is_array($paths)? $paths: [$paths] as $path) { |
|
| 34 | + foreach (is_array($paths) ? $paths : [$paths] as $path) { |
|
| 35 | 35 | \Illuminate\Support\Facades\Artisan::call('migrate:rollback', ['--path' => $path]); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public static function isInstalled($classOrAlias) |
| 21 | 21 | { |
| 22 | - return self::getClass($classOrAlias, true)? 1: 0; |
|
| 22 | + return self::getClass($classOrAlias, true) ? 1 : 0; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function isAvalable($classOrAlias) |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @return string; |
| 35 | 35 | */ |
| 36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
| 37 | - $modules = $installedOnly? self::getInstalled(): self::getAll(); |
|
| 37 | + $modules = $installedOnly ? self::getInstalled() : self::getAll(); |
|
| 38 | 38 | |
| 39 | 39 | if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
| 40 | 40 | |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public static function getAll() |
| 72 | 72 | { |
| 73 | - return self::getCached('epesi-modules-available', function () { |
|
| 73 | + return self::getCached('epesi-modules-available', function() { |
|
| 74 | 74 | $modules = collect(); |
| 75 | - foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules()?: []) as $moduleClass) { |
|
| 75 | + foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules() ?: []) as $moduleClass) { |
|
| 76 | 76 | $modules->add(['alias' => $moduleClass::alias(), 'class' => $moduleClass]); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected static function getCached($key, \Closure $default) |
| 91 | 91 | { |
| 92 | - if (! Cache::has($key)) { |
|
| 92 | + if (!Cache::has($key)) { |
|
| 93 | 93 | Cache::forever($key, $default()); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public static function collect($method, $args = []) |
| 127 | 127 | { |
| 128 | - $args = is_array($args)? $args: [$args]; |
|
| 128 | + $args = is_array($args) ? $args : [$args]; |
|
| 129 | 129 | |
| 130 | 130 | $installedModules = self::getInstalled(); |
| 131 | 131 | |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | $ret = []; |
| 140 | 140 | foreach ($installedModules as $module) { |
| 141 | - if (! $list = $module::$method(...$args)) continue; |
|
| 141 | + if (!$list = $module::$method(...$args)) continue; |
|
| 142 | 142 | |
| 143 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
| 143 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return $ret; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | return true; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
| 162 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
| 163 | 163 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | $parentModule = array_shift($unsatisfiedDependencies); |
| 211 | 211 | |
| 212 | 212 | if (self::$processing[$parentModule]?? false) { |
| 213 | - throw new Exception('Cross dependency: '. $parentModule); |
|
| 213 | + throw new Exception('Cross dependency: ' . $parentModule); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if (! self::isAvalable($parentModule)) { |
|
| 216 | + if (!self::isAvalable($parentModule)) { |
|
| 217 | 217 | throw new Exception('Module not found: "' . $parentModule . '"'); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -36,7 +36,9 @@ discard block |
||
| 36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
| 37 | 37 | $modules = $installedOnly? self::getInstalled(): self::getAll(); |
| 38 | 38 | |
| 39 | - if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
|
| 39 | + if (collect($modules)->contains($classOrAlias)) { |
|
| 40 | + return $classOrAlias; |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | return $modules[$classOrAlias]?? null; |
| 42 | 44 | } |
@@ -138,7 +140,9 @@ discard block |
||
| 138 | 140 | |
| 139 | 141 | $ret = []; |
| 140 | 142 | foreach ($installedModules as $module) { |
| 141 | - if (! $list = $module::$method(...$args)) continue; |
|
| 143 | + if (! $list = $module::$method(...$args)) { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 142 | 146 | |
| 143 | 147 | $ret = array_merge($ret, is_array($list)? $list: [$list]); |
| 144 | 148 | } |
@@ -9,61 +9,61 @@ |
||
| 9 | 9 | |
| 10 | 10 | class EpesiServiceProvider extends ServiceProvider |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Booting the package. |
|
| 14 | - */ |
|
| 15 | - public function boot() |
|
| 16 | - { |
|
| 17 | - $this->ensureHttps(); |
|
| 12 | + /** |
|
| 13 | + * Booting the package. |
|
| 14 | + */ |
|
| 15 | + public function boot() |
|
| 16 | + { |
|
| 17 | + $this->ensureHttps(); |
|
| 18 | 18 | |
| 19 | - Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => ['web']], function() { |
|
| 20 | - header("Cache-Control: no-cache, no-store, must-revalidate"); //HTTP 1.1 |
|
| 21 | - header("Pragma: no-cache"); //HTTP 1.0 |
|
| 22 | - header("Expires: 0"); |
|
| 19 | + Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => ['web']], function() { |
|
| 20 | + header("Cache-Control: no-cache, no-store, must-revalidate"); //HTTP 1.1 |
|
| 21 | + header("Pragma: no-cache"); //HTTP 1.0 |
|
| 22 | + header("Expires: 0"); |
|
| 23 | 23 | |
| 24 | - Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view')->middleware('auth'); |
|
| 24 | + Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view')->middleware('auth'); |
|
| 25 | 25 | |
| 26 | - Route::any('install', 'InstallController@index'); |
|
| 27 | - }); |
|
| 26 | + Route::any('install', 'InstallController@index'); |
|
| 27 | + }); |
|
| 28 | 28 | |
| 29 | - // call boot methods on all modules |
|
| 30 | - ModuleManager::call('boot'); |
|
| 29 | + // call boot methods on all modules |
|
| 30 | + ModuleManager::call('boot'); |
|
| 31 | 31 | |
| 32 | 32 | foreach (ModuleManager::collect('translations') as $path) { |
| 33 | 33 | $this->loadJsonTranslationsFrom($path); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - // Register admin service provider if in admin mode or in console |
|
| 37 | - // TODO: apply access restriction to admin mode |
|
| 36 | + // Register admin service provider if in admin mode or in console |
|
| 37 | + // TODO: apply access restriction to admin mode |
|
| 38 | 38 | // if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) { |
| 39 | - if ($this->app->runningInConsole() || request('admin', false)) { |
|
| 40 | - $this->app->register(AdminServiceProvider::class); |
|
| 41 | - } |
|
| 42 | - } |
|
| 39 | + if ($this->app->runningInConsole() || request('admin', false)) { |
|
| 40 | + $this->app->register(AdminServiceProvider::class); |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Register the provider. |
|
| 46 | - */ |
|
| 47 | - public function register() |
|
| 48 | - { |
|
| 49 | - $this->app->singleton(App::class); |
|
| 50 | - } |
|
| 44 | + /** |
|
| 45 | + * Register the provider. |
|
| 46 | + */ |
|
| 47 | + public function register() |
|
| 48 | + { |
|
| 49 | + $this->app->singleton(App::class); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Force to set https scheme if https enabled. |
|
| 54 | - * |
|
| 55 | - * @return void |
|
| 56 | - */ |
|
| 57 | - protected function ensureHttps() |
|
| 58 | - { |
|
| 59 | - if (config('epesi.https') || config('epesi.secure')) { |
|
| 60 | - url()->forceScheme('https'); |
|
| 61 | - $this->app['request']->server->set('HTTPS', true); |
|
| 62 | - } |
|
| 63 | - } |
|
| 52 | + /** |
|
| 53 | + * Force to set https scheme if https enabled. |
|
| 54 | + * |
|
| 55 | + * @return void |
|
| 56 | + */ |
|
| 57 | + protected function ensureHttps() |
|
| 58 | + { |
|
| 59 | + if (config('epesi.https') || config('epesi.secure')) { |
|
| 60 | + url()->forceScheme('https'); |
|
| 61 | + $this->app['request']->server->set('HTTPS', true); |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - protected function registerStorageDisk() |
|
| 66 | - { |
|
| 67 | - $this->app['config']['filesystems.disks.epesi'] = config('epesi.disk'); |
|
| 68 | - } |
|
| 65 | + protected function registerStorageDisk() |
|
| 66 | + { |
|
| 67 | + $this->app['config']['filesystems.disks.epesi'] = config('epesi.disk'); |
|
| 68 | + } |
|
| 69 | 69 | } |