@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | private static $variables; |
| 18 | 18 | |
| 19 | 19 | private static function cache() { |
| 20 | - if(isset(self::$variables)) return; |
|
| 20 | + if (isset(self::$variables)) return; |
|
| 21 | 21 | |
| 22 | 22 | self::$variables = self::pluck('value', 'name'); |
| 23 | 23 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public static function get($name, $default = null) { |
| 26 | 26 | self::cache(); |
| 27 | 27 | |
| 28 | - if (! self::$variables->has($name)) return $default; |
|
| 28 | + if (!self::$variables->has($name)) return $default; |
|
| 29 | 29 | |
| 30 | 30 | return self::$variables->get($name, $default)?? $default; |
| 31 | 31 | } |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | return self::updateOrCreate(compact('name'), compact('value')); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public static function forget($name, $throwError=true) { |
|
| 47 | + public static function forget($name, $throwError = true) { |
|
| 48 | 48 | self::cache(); |
| 49 | 49 | |
| 50 | - if (! self::$variables->has($name) && $throwError) { |
|
| 50 | + if (!self::$variables->has($name) && $throwError) { |
|
| 51 | 51 | throw new \Exception('No such variable in database: ' . $name); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -17,7 +17,9 @@ discard block |
||
| 17 | 17 | private static $variables; |
| 18 | 18 | |
| 19 | 19 | private static function cache() { |
| 20 | - if(isset(self::$variables)) return; |
|
| 20 | + if(isset(self::$variables)) { |
|
| 21 | + return; |
|
| 22 | + } |
|
| 21 | 23 | |
| 22 | 24 | self::$variables = self::pluck('value', 'name'); |
| 23 | 25 | } |
@@ -25,7 +27,9 @@ discard block |
||
| 25 | 27 | public static function get($name, $default = null) { |
| 26 | 28 | self::cache(); |
| 27 | 29 | |
| 28 | - if (! self::$variables->has($name)) return $default; |
|
| 30 | + if (! self::$variables->has($name)) { |
|
| 31 | + return $default; |
|
| 32 | + } |
|
| 29 | 33 | |
| 30 | 34 | return self::$variables->get($name, $default)?? $default; |
| 31 | 35 | } |
@@ -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')->nullable(); |
|
| 21 | - }); |
|
| 18 | + Schema::create('variables', function (Blueprint $table) { |
|
| 19 | + $table->string('name', 128)->primary(); |
|
| 20 | + $table->text('value')->nullable(); |
|
| 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')->nullable(); |
| 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); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | Storage::disk('public')->delete(self::alias() . '/tmp/' . $fileName); |
| 45 | 45 | }); |
| 46 | 46 | |
| 47 | - $logo->onUpload(function ($files) use ($form, $logo) { |
|
| 47 | + $logo->onUpload(function($files) use ($form, $logo) { |
|
| 48 | 48 | if ($files === 'error') return $form->error('logo', __('Error uploading image')); |
| 49 | 49 | |
| 50 | 50 | $tmpPath = self::alias() . '/tmp/' . $files['name']; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | 57 | $form->onSubmit(function($form) { |
| 58 | - if ($name = $form->model['custom_logo']? $form->model['logo']: null) { |
|
| 58 | + if ($name = $form->model['custom_logo'] ? $form->model['logo'] : null) { |
|
| 59 | 59 | $storage = Storage::disk('public'); |
| 60 | 60 | $from = self::alias() . '/tmp/' . $name; |
| 61 | 61 | $to = self::alias() . '/' . $name; |
@@ -10,66 +10,66 @@ |
||
| 10 | 10 | |
| 11 | 11 | class SystemController extends Controller |
| 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(Epesi $epesi) |
|
| 19 | - { |
|
| 20 | - // make sure the installation information is fresh |
|
| 21 | - ModuleManager::clearCache(); |
|
| 18 | + public function install(Epesi $epesi) |
|
| 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 | - $epesi->title = __(':epesi > Installation', ['epesi' => config('epesi.app.title')]); |
|
| 25 | + $epesi->title = __(':epesi > Installation', ['epesi' => config('epesi.app.title')]); |
|
| 26 | 26 | |
| 27 | - $epesi->initLayout('Centered'); |
|
| 27 | + $epesi->initLayout('Centered'); |
|
| 28 | 28 | |
| 29 | - $epesi->layout->set('logo', url('logo')); |
|
| 30 | - $epesi->layout->template->setHTML('copyright', config('epesi.app.copyright')); |
|
| 29 | + $epesi->layout->set('logo', url('logo')); |
|
| 30 | + $epesi->layout->template->setHTML('copyright', config('epesi.app.copyright')); |
|
| 31 | 31 | |
| 32 | - $epesi->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
| 32 | + $epesi->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
| 33 | 33 | |
| 34 | - return $epesi->response(); |
|
| 35 | - } |
|
| 34 | + return $epesi->response(); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public function home() |
|
| 38 | - { |
|
| 39 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\HomePageSettings::getUserHomePagePath(): 'install'); |
|
| 40 | - } |
|
| 37 | + public function home() |
|
| 38 | + { |
|
| 39 | + return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\HomePageSettings::getUserHomePagePath(): 'install'); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function logo() |
|
| 43 | - { |
|
| 44 | - $meta = \Epesi\Core\System\Logo\LogoSettings::getLogoMeta(); |
|
| 42 | + public function logo() |
|
| 43 | + { |
|
| 44 | + $meta = \Epesi\Core\System\Logo\LogoSettings::getLogoMeta(); |
|
| 45 | 45 | |
| 46 | - return response($meta['contents'], 200, ['Content-type' => $meta['mime']])->setMaxAge(604800)->setPublic(); |
|
| 47 | - } |
|
| 46 | + return response($meta['contents'], 200, ['Content-type' => $meta['mime']])->setMaxAge(604800)->setPublic(); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function view(Epesi $epesi, $module, $method = 'body', $args = []) |
|
| 50 | - { |
|
| 51 | - $epesi->initLayout(new LayoutView()); |
|
| 49 | + public function view(Epesi $epesi, $module, $method = 'body', $args = []) |
|
| 50 | + { |
|
| 51 | + $epesi->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 | - $epesi->add($view)->displayModuleContent($method, $args); |
|
| 69 | + $epesi->add($view)->displayModuleContent($method, $args); |
|
| 70 | 70 | |
| 71 | - $epesi->setLocation($view->location()); |
|
| 71 | + $epesi->setLocation($view->location()); |
|
| 72 | 72 | |
| 73 | - return $epesi->response(); |
|
| 74 | - } |
|
| 73 | + return $epesi->response(); |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -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 | $epesi->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 | $epesi->add($view)->displayModuleContent($method, $args); |
| 70 | 74 | |