@@ -8,13 +8,13 @@ |
||
8 | 8 | |
9 | 9 | class HomeController extends Controller |
10 | 10 | { |
11 | - public function index() |
|
12 | - { |
|
13 | - return SystemCore::isInstalled()? redirect()->route('home'): redirect('install'); |
|
14 | - } |
|
11 | + public function index() |
|
12 | + { |
|
13 | + return SystemCore::isInstalled()? redirect()->route('home'): redirect('install'); |
|
14 | + } |
|
15 | 15 | |
16 | - public function home() |
|
17 | - { |
|
18 | - return redirect(HomePageCommon::getUserHomePage()->path); |
|
19 | - } |
|
16 | + public function home() |
|
17 | + { |
|
18 | + return redirect(HomePageCommon::getUserHomePage()->path); |
|
19 | + } |
|
20 | 20 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function index() |
12 | 12 | { |
13 | - return SystemCore::isInstalled()? redirect()->route('home'): redirect('install'); |
|
13 | + return SystemCore::isInstalled() ? redirect()->route('home') : redirect('install'); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public function home() |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class CreateHomePageTable 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('home_pages', function (Blueprint $table) { |
|
19 | - $table->increments('id'); |
|
20 | - $table->string('path', 64); |
|
21 | - $table->string('role', 64); |
|
22 | - $table->smallInteger('priority'); |
|
23 | - }); |
|
24 | - } |
|
18 | + Schema::create('home_pages', function (Blueprint $table) { |
|
19 | + $table->increments('id'); |
|
20 | + $table->string('path', 64); |
|
21 | + $table->string('role', 64); |
|
22 | + $table->smallInteger('priority'); |
|
23 | + }); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Reverse the migrations. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function down() |
|
32 | - { |
|
33 | - Schema::dropIfExists('home_pages'); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Reverse the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function down() |
|
32 | + { |
|
33 | + Schema::dropIfExists('home_pages'); |
|
34 | + } |
|
35 | 35 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $this->down(); |
17 | 17 | |
18 | - Schema::create('home_pages', function (Blueprint $table) { |
|
18 | + Schema::create('home_pages', function(Blueprint $table) { |
|
19 | 19 | $table->increments('id'); |
20 | 20 | $table->string('path', 64); |
21 | 21 | $table->string('role', 64); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | static $cache; |
19 | 19 | |
20 | - if (! isset($cache)) { |
|
20 | + if (!isset($cache)) { |
|
21 | 21 | $cache = []; |
22 | 22 | foreach (HomePageJoint::collect() as $joint) { |
23 | 23 | $cache[$joint->link()] = $joint->caption(); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public static function getUserHomePage() |
36 | 36 | { |
37 | - if (! $user = Auth::user()) return; |
|
37 | + if (!$user = Auth::user()) return; |
|
38 | 38 | |
39 | 39 | return HomePage::whereIn('role', $user->roles()->pluck('name'))->orderBy('priority')->first(); |
40 | 40 | } |
@@ -34,7 +34,9 @@ |
||
34 | 34 | */ |
35 | 35 | public static function getUserHomePage() |
36 | 36 | { |
37 | - if (! $user = Auth::user()) return; |
|
37 | + if (! $user = Auth::user()) { |
|
38 | + return; |
|
39 | + } |
|
38 | 40 | |
39 | 41 | return HomePage::whereIn('role', $user->roles()->pluck('name'))->orderBy('priority')->first(); |
40 | 42 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return [['Template', $availablePages[$row[$column]]]]; |
46 | 46 | }]); |
47 | 47 | |
48 | - $this->grid->addDragHandler()->onReorder(function ($order) { |
|
48 | + $this->grid->addDragHandler()->onReorder(function($order) { |
|
49 | 49 | $result = true; |
50 | 50 | foreach ($this->getHomepages() as $homepage) { |
51 | 51 | $homepage->priority = array_search($homepage->id, $order); |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $result &= $homepage->save(); |
54 | 54 | } |
55 | 55 | |
56 | - return $result? $this->notify(__('Homepages reordered!')): $this->notifyError(__('Error saving order!')); |
|
56 | + return $result ? $this->notify(__('Homepages reordered!')) : $this->notifyError(__('Error saving order!')); |
|
57 | 57 | }); |
58 | 58 | |
59 | - $this->grid->addAction(['icon' => 'red trash'], function ($jschain, $id) { |
|
59 | + $this->grid->addAction(['icon' => 'red trash'], function($jschain, $id) { |
|
60 | 60 | HomePage::find($id)->delete(); |
61 | 61 | |
62 | 62 | return $jschain->closest('tr')->transition('fade left'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public function getHomepageForm() |
94 | 94 | { |
95 | - if (! $this->form) { |
|
95 | + if (!$this->form) { |
|
96 | 96 | $this->form = new Form(['buttonSave' => ['Button', __('Save'), 'primary']]); |
97 | 97 | |
98 | 98 | $this->form->addHook('submit', function($form) { |
@@ -9,66 +9,66 @@ |
||
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('/', 'HomeController@index'); |
|
25 | - Route::any('install', 'InstallController@index'); |
|
24 | + Route::any('/', 'HomeController@index'); |
|
25 | + Route::any('install', 'InstallController@index'); |
|
26 | 26 | |
27 | - Route::group(['middleware' => 'auth'], function() { |
|
28 | - Route::any('home', 'HomeController@home')->name('home'); |
|
27 | + Route::group(['middleware' => 'auth'], function() { |
|
28 | + Route::any('home', 'HomeController@home')->name('home'); |
|
29 | 29 | |
30 | - Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view'); |
|
31 | - }); |
|
32 | - }); |
|
30 | + Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view'); |
|
31 | + }); |
|
32 | + }); |
|
33 | 33 | |
34 | - // call boot methods on all modules |
|
35 | - ModuleManager::call('boot'); |
|
34 | + // call boot methods on all modules |
|
35 | + ModuleManager::call('boot'); |
|
36 | 36 | |
37 | 37 | foreach (ModuleManager::collect('translations') as $path) { |
38 | 38 | $this->loadJsonTranslationsFrom($path); |
39 | 39 | } |
40 | 40 | |
41 | - // Register admin service provider if in admin mode or in console |
|
42 | - // TODO: apply access restriction to admin mode |
|
41 | + // Register admin service provider if in admin mode or in console |
|
42 | + // TODO: apply access restriction to admin mode |
|
43 | 43 | // if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) { |
44 | - if ($this->app->runningInConsole() || request('admin', false)) { |
|
45 | - $this->app->register(AdminServiceProvider::class); |
|
46 | - } |
|
47 | - } |
|
44 | + if ($this->app->runningInConsole() || request('admin', false)) { |
|
45 | + $this->app->register(AdminServiceProvider::class); |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Register the provider. |
|
51 | - */ |
|
52 | - public function register() |
|
53 | - { |
|
54 | - $this->app->singleton(App::class); |
|
55 | - } |
|
49 | + /** |
|
50 | + * Register the provider. |
|
51 | + */ |
|
52 | + public function register() |
|
53 | + { |
|
54 | + $this->app->singleton(App::class); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Force to set https scheme if https enabled. |
|
59 | - * |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - protected function ensureHttps() |
|
63 | - { |
|
64 | - if (config('epesi.https') || config('epesi.secure')) { |
|
65 | - url()->forceScheme('https'); |
|
66 | - $this->app['request']->server->set('HTTPS', true); |
|
67 | - } |
|
68 | - } |
|
57 | + /** |
|
58 | + * Force to set https scheme if https enabled. |
|
59 | + * |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + protected function ensureHttps() |
|
63 | + { |
|
64 | + if (config('epesi.https') || config('epesi.secure')) { |
|
65 | + url()->forceScheme('https'); |
|
66 | + $this->app['request']->server->set('HTTPS', true); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - protected function registerStorageDisk() |
|
71 | - { |
|
72 | - $this->app['config']['filesystems.disks.epesi'] = config('epesi.disk'); |
|
73 | - } |
|
70 | + protected function registerStorageDisk() |
|
71 | + { |
|
72 | + $this->app['config']['filesystems.disks.epesi'] = config('epesi.disk'); |
|
73 | + } |
|
74 | 74 | } |