@@ -6,31 +6,31 @@ |
||
6 | 6 | |
7 | 7 | class CreateUsersTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('users', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->string('name'); |
|
19 | - $table->string('email')->unique(); |
|
20 | - $table->timestamp('email_verified_at')->nullable(); |
|
21 | - $table->string('password'); |
|
22 | - $table->rememberToken(); |
|
23 | - $table->timestamps(); |
|
24 | - }); |
|
25 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('users', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->string('name'); |
|
19 | + $table->string('email')->unique(); |
|
20 | + $table->timestamp('email_verified_at')->nullable(); |
|
21 | + $table->string('password'); |
|
22 | + $table->rememberToken(); |
|
23 | + $table->timestamps(); |
|
24 | + }); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Reverse the migrations. |
|
29 | - * |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public function down() |
|
33 | - { |
|
34 | - Schema::dropIfExists('users'); |
|
35 | - } |
|
27 | + /** |
|
28 | + * Reverse the migrations. |
|
29 | + * |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public function down() |
|
33 | + { |
|
34 | + Schema::dropIfExists('users'); |
|
35 | + } |
|
36 | 36 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('users', function (Blueprint $table) { |
|
16 | + Schema::create('users', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->string('email')->unique(); |
@@ -6,97 +6,97 @@ |
||
6 | 6 | |
7 | 7 | class CreatePermissionTables extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - $tableNames = config('permission.table_names'); |
|
17 | - $columnNames = config('permission.column_names'); |
|
18 | - |
|
19 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
20 | - $table->bigIncrements('id'); |
|
21 | - $table->string('name'); |
|
22 | - $table->string('guard_name'); |
|
23 | - $table->timestamps(); |
|
24 | - }); |
|
25 | - |
|
26 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
27 | - $table->bigIncrements('id'); |
|
28 | - $table->string('name'); |
|
29 | - $table->string('guard_name'); |
|
30 | - $table->timestamps(); |
|
31 | - }); |
|
32 | - |
|
33 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
34 | - $table->unsignedBigInteger('permission_id'); |
|
35 | - |
|
36 | - $table->string('model_type'); |
|
37 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
38 | - $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index'); |
|
39 | - |
|
40 | - $table->foreign('permission_id') |
|
41 | - ->references('id') |
|
42 | - ->on($tableNames['permissions']) |
|
43 | - ->onDelete('cascade'); |
|
44 | - |
|
45 | - $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'], |
|
46 | - 'model_has_permissions_permission_model_type_primary'); |
|
47 | - }); |
|
48 | - |
|
49 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
50 | - $table->unsignedBigInteger('role_id'); |
|
51 | - |
|
52 | - $table->string('model_type'); |
|
53 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
54 | - $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index'); |
|
55 | - |
|
56 | - $table->foreign('role_id') |
|
57 | - ->references('id') |
|
58 | - ->on($tableNames['roles']) |
|
59 | - ->onDelete('cascade'); |
|
60 | - |
|
61 | - $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'], |
|
62 | - 'model_has_roles_role_model_type_primary'); |
|
63 | - }); |
|
64 | - |
|
65 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
66 | - $table->unsignedBigInteger('permission_id'); |
|
67 | - $table->unsignedBigInteger('role_id'); |
|
68 | - |
|
69 | - $table->foreign('permission_id') |
|
70 | - ->references('id') |
|
71 | - ->on($tableNames['permissions']) |
|
72 | - ->onDelete('cascade'); |
|
73 | - |
|
74 | - $table->foreign('role_id') |
|
75 | - ->references('id') |
|
76 | - ->on($tableNames['roles']) |
|
77 | - ->onDelete('cascade'); |
|
78 | - |
|
79 | - $table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary'); |
|
80 | - }); |
|
81 | - |
|
82 | - app('cache') |
|
83 | - ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) |
|
84 | - ->forget(config('permission.cache.key')); |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Reverse the migrations. |
|
89 | - * |
|
90 | - * @return void |
|
91 | - */ |
|
92 | - public function down() |
|
93 | - { |
|
94 | - $tableNames = config('permission.table_names'); |
|
95 | - |
|
96 | - Schema::drop($tableNames['role_has_permissions']); |
|
97 | - Schema::drop($tableNames['model_has_roles']); |
|
98 | - Schema::drop($tableNames['model_has_permissions']); |
|
99 | - Schema::drop($tableNames['roles']); |
|
100 | - Schema::drop($tableNames['permissions']); |
|
101 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + $tableNames = config('permission.table_names'); |
|
17 | + $columnNames = config('permission.column_names'); |
|
18 | + |
|
19 | + Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
20 | + $table->bigIncrements('id'); |
|
21 | + $table->string('name'); |
|
22 | + $table->string('guard_name'); |
|
23 | + $table->timestamps(); |
|
24 | + }); |
|
25 | + |
|
26 | + Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
27 | + $table->bigIncrements('id'); |
|
28 | + $table->string('name'); |
|
29 | + $table->string('guard_name'); |
|
30 | + $table->timestamps(); |
|
31 | + }); |
|
32 | + |
|
33 | + Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
34 | + $table->unsignedBigInteger('permission_id'); |
|
35 | + |
|
36 | + $table->string('model_type'); |
|
37 | + $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
38 | + $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index'); |
|
39 | + |
|
40 | + $table->foreign('permission_id') |
|
41 | + ->references('id') |
|
42 | + ->on($tableNames['permissions']) |
|
43 | + ->onDelete('cascade'); |
|
44 | + |
|
45 | + $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'], |
|
46 | + 'model_has_permissions_permission_model_type_primary'); |
|
47 | + }); |
|
48 | + |
|
49 | + Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
50 | + $table->unsignedBigInteger('role_id'); |
|
51 | + |
|
52 | + $table->string('model_type'); |
|
53 | + $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
54 | + $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index'); |
|
55 | + |
|
56 | + $table->foreign('role_id') |
|
57 | + ->references('id') |
|
58 | + ->on($tableNames['roles']) |
|
59 | + ->onDelete('cascade'); |
|
60 | + |
|
61 | + $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'], |
|
62 | + 'model_has_roles_role_model_type_primary'); |
|
63 | + }); |
|
64 | + |
|
65 | + Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
66 | + $table->unsignedBigInteger('permission_id'); |
|
67 | + $table->unsignedBigInteger('role_id'); |
|
68 | + |
|
69 | + $table->foreign('permission_id') |
|
70 | + ->references('id') |
|
71 | + ->on($tableNames['permissions']) |
|
72 | + ->onDelete('cascade'); |
|
73 | + |
|
74 | + $table->foreign('role_id') |
|
75 | + ->references('id') |
|
76 | + ->on($tableNames['roles']) |
|
77 | + ->onDelete('cascade'); |
|
78 | + |
|
79 | + $table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary'); |
|
80 | + }); |
|
81 | + |
|
82 | + app('cache') |
|
83 | + ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) |
|
84 | + ->forget(config('permission.cache.key')); |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Reverse the migrations. |
|
89 | + * |
|
90 | + * @return void |
|
91 | + */ |
|
92 | + public function down() |
|
93 | + { |
|
94 | + $tableNames = config('permission.table_names'); |
|
95 | + |
|
96 | + Schema::drop($tableNames['role_has_permissions']); |
|
97 | + Schema::drop($tableNames['model_has_roles']); |
|
98 | + Schema::drop($tableNames['model_has_permissions']); |
|
99 | + Schema::drop($tableNames['roles']); |
|
100 | + Schema::drop($tableNames['permissions']); |
|
101 | + } |
|
102 | 102 | } |
@@ -16,21 +16,21 @@ discard block |
||
16 | 16 | $tableNames = config('permission.table_names'); |
17 | 17 | $columnNames = config('permission.column_names'); |
18 | 18 | |
19 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
19 | + Schema::create($tableNames['permissions'], function(Blueprint $table) { |
|
20 | 20 | $table->bigIncrements('id'); |
21 | 21 | $table->string('name'); |
22 | 22 | $table->string('guard_name'); |
23 | 23 | $table->timestamps(); |
24 | 24 | }); |
25 | 25 | |
26 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
26 | + Schema::create($tableNames['roles'], function(Blueprint $table) { |
|
27 | 27 | $table->bigIncrements('id'); |
28 | 28 | $table->string('name'); |
29 | 29 | $table->string('guard_name'); |
30 | 30 | $table->timestamps(); |
31 | 31 | }); |
32 | 32 | |
33 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
33 | + Schema::create($tableNames['model_has_permissions'], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
34 | 34 | $table->unsignedBigInteger('permission_id'); |
35 | 35 | |
36 | 36 | $table->string('model_type'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'model_has_permissions_permission_model_type_primary'); |
47 | 47 | }); |
48 | 48 | |
49 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
49 | + Schema::create($tableNames['model_has_roles'], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
50 | 50 | $table->unsignedBigInteger('role_id'); |
51 | 51 | |
52 | 52 | $table->string('model_type'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'model_has_roles_role_model_type_primary'); |
63 | 63 | }); |
64 | 64 | |
65 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
65 | + Schema::create($tableNames['role_has_permissions'], function(Blueprint $table) use ($tableNames) { |
|
66 | 66 | $table->unsignedBigInteger('permission_id'); |
67 | 67 | $table->unsignedBigInteger('role_id'); |
68 | 68 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | public static function boot() |
51 | 51 | { |
52 | 52 | // allow Super Admin full access |
53 | - Gate::after(function ($user, $ability) { |
|
53 | + Gate::after(function($user, $ability) { |
|
54 | 54 | return $user->hasRole('Super Admin'); |
55 | 55 | }); |
56 | 56 | } |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | private static function cacheUserVariables() { |
26 | - if(isset(self::$userVariables)) return; |
|
26 | + if(isset(self::$userVariables)) { |
|
27 | + return; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $userId = Auth::id(); |
29 | 31 | |
@@ -33,7 +35,9 @@ discard block |
||
33 | 35 | } |
34 | 36 | |
35 | 37 | private static function cacheAdminVariables() { |
36 | - if(isset(self::$adminVariables)) return; |
|
38 | + if(isset(self::$adminVariables)) { |
|
39 | + return; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | foreach (self::where('user_id', 0) as $row) { |
39 | 43 | self::$adminVariables[$row['group']][$row['name']] = $row['value']; |
@@ -43,7 +47,9 @@ discard block |
||
43 | 47 | public static function get($group, $name, $user = null) { |
44 | 48 | $user = $user?: Auth::id(); |
45 | 49 | |
46 | - if (!$user || !is_numeric($user)) return; |
|
50 | + if (!$user || !is_numeric($user)) { |
|
51 | + return; |
|
52 | + } |
|
47 | 53 | |
48 | 54 | self::cache(); |
49 | 55 | |
@@ -53,7 +59,9 @@ discard block |
||
53 | 59 | public static function getGroup($group, $user = null) { |
54 | 60 | $user = $user?: Auth::id(); |
55 | 61 | |
56 | - if (!$user || !is_numeric($user)) return; |
|
62 | + if (!$user || !is_numeric($user)) { |
|
63 | + return; |
|
64 | + } |
|
57 | 65 | |
58 | 66 | self::cache(); |
59 | 67 | |
@@ -75,7 +83,9 @@ discard block |
||
75 | 83 | public static function put($group, $name, $value, $user = null) { |
76 | 84 | $user_id = $user?: Auth::id(); |
77 | 85 | |
78 | - if (!$user_id || !is_numeric($user_id)) return; |
|
86 | + if (!$user_id || !is_numeric($user_id)) { |
|
87 | + return; |
|
88 | + } |
|
79 | 89 | |
80 | 90 | self::cache(); |
81 | 91 | |
@@ -103,7 +113,9 @@ discard block |
||
103 | 113 | public static function forget($group, $name, $user = null) { |
104 | 114 | $user_id = $user?: Auth::id(); |
105 | 115 | |
106 | - if (!$user_id || !is_numeric($user_id)) return; |
|
116 | + if (!$user_id || !is_numeric($user_id)) { |
|
117 | + return; |
|
118 | + } |
|
107 | 119 | |
108 | 120 | self::cache(); |
109 | 121 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | private static function cacheUserVariables() { |
26 | - if(isset(self::$userVariables)) return; |
|
26 | + if (isset(self::$userVariables)) return; |
|
27 | 27 | |
28 | 28 | $userId = Auth::id(); |
29 | 29 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | private static function cacheAdminVariables() { |
36 | - if(isset(self::$adminVariables)) return; |
|
36 | + if (isset(self::$adminVariables)) return; |
|
37 | 37 | |
38 | 38 | foreach (self::where('user_id', 0) as $row) { |
39 | 39 | self::$adminVariables[$row['group']][$row['name']] = $row['value']; |
@@ -41,39 +41,39 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public static function get($group, $name, $user = null) { |
44 | - $user = $user?: Auth::id(); |
|
44 | + $user = $user ?: Auth::id(); |
|
45 | 45 | |
46 | 46 | if (!$user || !is_numeric($user)) return; |
47 | 47 | |
48 | 48 | self::cache(); |
49 | 49 | |
50 | - return self::$userVariables[$user][$group][$name]?? self::getAdmin($group, $name); |
|
50 | + return self::$userVariables[$user][$group][$name] ?? self::getAdmin($group, $name); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public static function getGroup($group, $user = null) { |
54 | - $user = $user?: Auth::id(); |
|
54 | + $user = $user ?: Auth::id(); |
|
55 | 55 | |
56 | 56 | if (!$user || !is_numeric($user)) return; |
57 | 57 | |
58 | 58 | self::cache(); |
59 | 59 | |
60 | - return self::$userVariables[$user][$group]?? []; |
|
60 | + return self::$userVariables[$user][$group] ?? []; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public static function getAdmin($group, $name) { |
64 | 64 | self::cache(); |
65 | 65 | |
66 | - return self::$adminVariables[$group][$name]?? null; |
|
66 | + return self::$adminVariables[$group][$name] ?? null; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public static function getAdminGroup($group) { |
70 | 70 | self::cache(); |
71 | 71 | |
72 | - return self::$adminVariables[$group]?? []; |
|
72 | + return self::$adminVariables[$group] ?? []; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public static function put($group, $name, $value, $user = null) { |
76 | - $user_id = $user?: Auth::id(); |
|
76 | + $user_id = $user ?: Auth::id(); |
|
77 | 77 | |
78 | 78 | if (!$user_id || !is_numeric($user_id)) return; |
79 | 79 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | public static function forget($group, $name, $user = null) { |
104 | - $user_id = $user?: Auth::id(); |
|
104 | + $user_id = $user ?: Auth::id(); |
|
105 | 105 | |
106 | 106 | if (!$user_id || !is_numeric($user_id)) return; |
107 | 107 |
@@ -6,31 +6,31 @@ |
||
6 | 6 | |
7 | 7 | class CreateUserSettingsTable 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('user_settings', function (Blueprint $table) { |
|
19 | - $table->increments('id'); |
|
20 | - $table->unsignedInteger('user_id'); |
|
21 | - $table->string('group', 512); |
|
22 | - $table->string('name', 128); |
|
23 | - $table->text('value'); |
|
24 | - }); |
|
25 | - } |
|
18 | + Schema::create('user_settings', function (Blueprint $table) { |
|
19 | + $table->increments('id'); |
|
20 | + $table->unsignedInteger('user_id'); |
|
21 | + $table->string('group', 512); |
|
22 | + $table->string('name', 128); |
|
23 | + $table->text('value'); |
|
24 | + }); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Reverse the migrations. |
|
29 | - * |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public function down() |
|
33 | - { |
|
34 | - Schema::dropIfExists('user_settings'); |
|
35 | - } |
|
27 | + /** |
|
28 | + * Reverse the migrations. |
|
29 | + * |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public function down() |
|
33 | + { |
|
34 | + Schema::dropIfExists('user_settings'); |
|
35 | + } |
|
36 | 36 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $this->down(); |
17 | 17 | |
18 | - Schema::create('user_settings', function (Blueprint $table) { |
|
18 | + Schema::create('user_settings', function(Blueprint $table) { |
|
19 | 19 | $table->increments('id'); |
20 | 20 | $table->unsignedInteger('user_id'); |
21 | 21 | $table->string('group', 512); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function group() |
27 | 27 | { |
28 | - return $this->group?: static::class; |
|
28 | + return $this->group ?: static::class; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -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.ui.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; |
@@ -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 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | { |
32 | 32 | $modules = ModuleManager::getAll(); |
33 | 33 | |
34 | - return $modules->filter(function ($subModuleClass) use ($modules) { |
|
35 | - return ! $modules->map(function($moduleClass){ |
|
34 | + return $modules->filter(function($subModuleClass) use ($modules) { |
|
35 | + return !$modules->map(function($moduleClass) { |
|
36 | 36 | return $moduleClass::namespace(); |
37 | 37 | })->contains($subModuleClass::parentNamespace()); |
38 | 38 | })->sort(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $section->add($label, 'title')->setStyle('float', 'right'); |
68 | 68 | |
69 | - $submodules = ModuleManager::getAll()->filter(function ($subModuleClass) use ($moduleClass) { |
|
69 | + $submodules = ModuleManager::getAll()->filter(function($subModuleClass) use ($moduleClass) { |
|
70 | 70 | return $subModuleClass::isSubModuleOf($moduleClass); |
71 | 71 | }); |
72 | 72 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | |
81 | 81 | public function formatModuleInfo($moduleClass) |
82 | 82 | { |
83 | - $moduleInfo = (array) ($moduleClass::info()?: __(' No details provided by author')); |
|
83 | + $moduleInfo = (array) ($moduleClass::info() ?: __(' No details provided by author')); |
|
84 | 84 | |
85 | 85 | $ret = []; |
86 | 86 | foreach ($moduleInfo as $label => $text) { |
87 | - $ret[] = (is_string($label)? "<strong>$label</strong>: ": '') . $text; |
|
87 | + $ret[] = (is_string($label) ? "<strong>$label</strong>: " : '') . $text; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return implode('<br>', $ret); |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | |
125 | 125 | $form = $view->add(new Form()); |
126 | 126 | foreach ($recommended as $childModule) { |
127 | - if (! ModuleManager::isAvailable($childModule)) continue; |
|
127 | + if (!ModuleManager::isAvailable($childModule)) continue; |
|
128 | 128 | |
129 | 129 | $form->addField($childModule::alias(), ['CheckBox', 'caption' => $childModule::label()]); |
130 | 130 | } |
131 | 131 | |
132 | - $form->onSubmit(function ($form) use ($moduleClass) { |
|
132 | + $form->onSubmit(function($form) use ($moduleClass) { |
|
133 | 133 | ob_start(); |
134 | 134 | ModuleManager::install($moduleClass, array_keys($form->getValues(), true)); |
135 | 135 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | $view->add(['Button', __('Install'), 'primary'])->on('click', [ |
141 | - isset($form)? $form->submit(): $installCallback |
|
141 | + isset($form) ? $form->submit() : $installCallback |
|
142 | 142 | ]); |
143 | 143 | }); |
144 | 144 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | ]; |
165 | 165 | }); |
166 | 166 | |
167 | - if ($dependents = ModuleManager::listDependents()[$moduleClass]?? []) { |
|
167 | + if ($dependents = ModuleManager::listDependents()[$moduleClass] ?? []) { |
|
168 | 168 | $modal = $this->add(['Modal', 'title' => __(':module Module Installation', ['module' => $moduleClass::label()])])->set(function($view) use ($moduleClass, $dependents, $uninstallCallback) { |
169 | 169 | $message = $view->add(['Message', __('Module is required by following modules')]); |
170 | 170 |