@@ -16,17 +16,17 @@ |
||
16 | 16 | ->title('Dashboard') |
17 | 17 | ->description('Description...') |
18 | 18 | ->row(Dashboard::title()) |
19 | - ->row(function (Row $row) { |
|
19 | + ->row(function(Row $row) { |
|
20 | 20 | |
21 | - $row->column(4, function (Column $column) { |
|
21 | + $row->column(4, function(Column $column) { |
|
22 | 22 | $column->append(Dashboard::environment()); |
23 | 23 | }); |
24 | 24 | |
25 | - $row->column(4, function (Column $column) { |
|
25 | + $row->column(4, function(Column $column) { |
|
26 | 26 | $column->append(Dashboard::extensions()); |
27 | 27 | }); |
28 | 28 | |
29 | - $row->column(4, function (Column $column) { |
|
29 | + $row->column(4, function(Column $column) { |
|
30 | 30 | $column->append(Dashboard::dependencies()); |
31 | 31 | }); |
32 | 32 | }); |
@@ -8,8 +8,8 @@ |
||
8 | 8 | 'prefix' => config('admin.route.prefix'), |
9 | 9 | 'namespace' => config('admin.route.namespace'), |
10 | 10 | 'middleware' => config('admin.route.middleware'), |
11 | - 'as' => config('admin.route.prefix') . '.', |
|
12 | -], function (Router $router) { |
|
11 | + 'as' => config('admin.route.prefix').'.', |
|
12 | +], function(Router $router) { |
|
13 | 13 | |
14 | 14 | $router->get('/', 'HomeController@index')->name('home'); |
15 | 15 |
@@ -19,34 +19,34 @@ discard block |
||
19 | 19 | */ |
20 | 20 | |
21 | 21 | class FlattedString { |
22 | - public $value = ''; |
|
23 | - public function __construct($value) { |
|
22 | + public $value = ''; |
|
23 | + public function __construct($value) { |
|
24 | 24 | $this->value = $value; |
25 | - } |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | class Flatted { |
29 | 29 | |
30 | - // public utilities |
|
31 | - public static function parse($json, $assoc = false, $depth = 512, $options = 0) { |
|
30 | + // public utilities |
|
31 | + public static function parse($json, $assoc = false, $depth = 512, $options = 0) { |
|
32 | 32 | $input = array_map( |
33 | - 'Flatted::asString', |
|
34 | - array_map( |
|
33 | + 'Flatted::asString', |
|
34 | + array_map( |
|
35 | 35 | 'Flatted::wrap', |
36 | 36 | json_decode($json, $assoc, $depth, $options) |
37 | - ) |
|
37 | + ) |
|
38 | 38 | ); |
39 | 39 | $value = &$input[0]; |
40 | 40 | $set = array(); |
41 | 41 | $set[] = &$value; |
42 | 42 | if (is_array($value)) |
43 | - return Flatted::loop(false, array_keys($value), $input, $set, $value); |
|
43 | + return Flatted::loop(false, array_keys($value), $input, $set, $value); |
|
44 | 44 | if (is_object($value)) |
45 | - return Flatted::loop(true, Flatted::keys($value), $input, $set, $value); |
|
45 | + return Flatted::loop(true, Flatted::keys($value), $input, $set, $value); |
|
46 | 46 | return $value; |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - public static function stringify($value, $options = 0, $depth = 512) { |
|
49 | + public static function stringify($value, $options = 0, $depth = 512) { |
|
50 | 50 | $known = new stdClass; |
51 | 51 | $known->key = array(); |
52 | 52 | $known->value = array(); |
@@ -54,103 +54,103 @@ discard block |
||
54 | 54 | $output = array(); |
55 | 55 | $i = intval(Flatted::index($known, $input, $value)); |
56 | 56 | while ($i < count($input)) { |
57 | - $output[$i] = Flatted::transform($known, $input, $input[$i]); |
|
58 | - $i++; |
|
57 | + $output[$i] = Flatted::transform($known, $input, $input[$i]); |
|
58 | + $i++; |
|
59 | 59 | } |
60 | 60 | return json_encode($output, $options, $depth); |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - // private helpers |
|
64 | - private static function asString($value) { |
|
63 | + // private helpers |
|
64 | + private static function asString($value) { |
|
65 | 65 | return $value instanceof FlattedString ? $value->value : $value; |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - private static function index(&$known, &$input, &$value) { |
|
68 | + private static function index(&$known, &$input, &$value) { |
|
69 | 69 | $input[] = &$value; |
70 | 70 | $index = strval(count($input) - 1); |
71 | 71 | $known->key[] = &$value; |
72 | 72 | $known->value[] = &$index; |
73 | 73 | return $index; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - private static function keys(&$value) { |
|
76 | + private static function keys(&$value) { |
|
77 | 77 | $obj = new ReflectionObject($value); |
78 | 78 | $props = $obj->getProperties(); |
79 | 79 | $keys = array(); |
80 | 80 | foreach ($props as $prop) |
81 | - $keys[] = $prop->getName(); |
|
81 | + $keys[] = $prop->getName(); |
|
82 | 82 | return $keys; |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - private static function loop($obj, $keys, &$input, &$set, &$output) { |
|
85 | + private static function loop($obj, $keys, &$input, &$set, &$output) { |
|
86 | 86 | foreach ($keys as $key) { |
87 | - $value = $obj ? $output->$key : $output[$key]; |
|
88 | - if ($value instanceof FlattedString) |
|
87 | + $value = $obj ? $output->$key : $output[$key]; |
|
88 | + if ($value instanceof FlattedString) |
|
89 | 89 | Flatted::ref($obj, $key, $input[$value->value], $input, $set, $output); |
90 | 90 | } |
91 | 91 | return $output; |
92 | - } |
|
92 | + } |
|
93 | 93 | |
94 | - private static function relate(&$known, &$input, &$value) { |
|
94 | + private static function relate(&$known, &$input, &$value) { |
|
95 | 95 | if (is_string($value) || is_array($value) || is_object($value)) { |
96 | - $key = array_search($value, $known->key, true); |
|
97 | - if ($key !== false) |
|
96 | + $key = array_search($value, $known->key, true); |
|
97 | + if ($key !== false) |
|
98 | 98 | return $known->value[$key]; |
99 | - return Flatted::index($known, $input, $value); |
|
99 | + return Flatted::index($known, $input, $value); |
|
100 | 100 | } |
101 | 101 | return $value; |
102 | - } |
|
102 | + } |
|
103 | 103 | |
104 | - private static function ref($obj, &$key, &$value, &$input, &$set, &$output) { |
|
104 | + private static function ref($obj, &$key, &$value, &$input, &$set, &$output) { |
|
105 | 105 | if (is_array($value) && !in_array($value, $set, true)) { |
106 | - $set[] = $value; |
|
107 | - $value = Flatted::loop(false, array_keys($value), $input, $set, $value); |
|
106 | + $set[] = $value; |
|
107 | + $value = Flatted::loop(false, array_keys($value), $input, $set, $value); |
|
108 | 108 | } |
109 | 109 | elseif (is_object($value) && !in_array($value, $set, true)) { |
110 | - $set[] = $value; |
|
111 | - $value = Flatted::loop(true, Flatted::keys($value), $input, $set, $value); |
|
110 | + $set[] = $value; |
|
111 | + $value = Flatted::loop(true, Flatted::keys($value), $input, $set, $value); |
|
112 | 112 | } |
113 | 113 | if ($obj) { |
114 | - $output->$key = &$value; |
|
114 | + $output->$key = &$value; |
|
115 | 115 | } |
116 | 116 | else { |
117 | - $output[$key] = &$value; |
|
117 | + $output[$key] = &$value; |
|
118 | + } |
|
118 | 119 | } |
119 | - } |
|
120 | 120 | |
121 | - private static function transform(&$known, &$input, &$value) { |
|
121 | + private static function transform(&$known, &$input, &$value) { |
|
122 | 122 | if (is_array($value)) { |
123 | - return array_map( |
|
123 | + return array_map( |
|
124 | 124 | function ($value) use(&$known, &$input) { |
125 | - return Flatted::relate($known, $input, $value); |
|
125 | + return Flatted::relate($known, $input, $value); |
|
126 | 126 | }, |
127 | 127 | $value |
128 | - ); |
|
128 | + ); |
|
129 | 129 | } |
130 | 130 | if (is_object($value)) { |
131 | - $object = new stdClass; |
|
132 | - $keys = Flatted::keys($value); |
|
133 | - foreach ($keys as $key) |
|
131 | + $object = new stdClass; |
|
132 | + $keys = Flatted::keys($value); |
|
133 | + foreach ($keys as $key) |
|
134 | 134 | $object->$key = Flatted::relate($known, $input, $value->$key); |
135 | - return $object; |
|
135 | + return $object; |
|
136 | 136 | } |
137 | 137 | return $value; |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - private static function wrap($value) { |
|
140 | + private static function wrap($value) { |
|
141 | 141 | if (is_string($value)) { |
142 | - return new FlattedString($value); |
|
142 | + return new FlattedString($value); |
|
143 | 143 | } |
144 | 144 | if (is_array($value)) { |
145 | - return array_map('Flatted::wrap', $value); |
|
145 | + return array_map('Flatted::wrap', $value); |
|
146 | 146 | } |
147 | 147 | if (is_object($value)) { |
148 | - $keys = Flatted::keys($value); |
|
149 | - foreach ($keys as $key) { |
|
148 | + $keys = Flatted::keys($value); |
|
149 | + foreach ($keys as $key) { |
|
150 | 150 | $value->$key = self::wrap($value->$key); |
151 | - } |
|
151 | + } |
|
152 | 152 | } |
153 | 153 | return $value; |
154 | - } |
|
154 | + } |
|
155 | 155 | } |
156 | 156 | ?> |
157 | 157 | \ No newline at end of file |
@@ -121,7 +121,7 @@ |
||
121 | 121 | private static function transform(&$known, &$input, &$value) { |
122 | 122 | if (is_array($value)) { |
123 | 123 | return array_map( |
124 | - function ($value) use(&$known, &$input) { |
|
124 | + function($value) use(&$known, &$input) { |
|
125 | 125 | return Flatted::relate($known, $input, $value); |
126 | 126 | }, |
127 | 127 | $value |
@@ -39,10 +39,12 @@ discard block |
||
39 | 39 | $value = &$input[0]; |
40 | 40 | $set = array(); |
41 | 41 | $set[] = &$value; |
42 | - if (is_array($value)) |
|
43 | - return Flatted::loop(false, array_keys($value), $input, $set, $value); |
|
44 | - if (is_object($value)) |
|
45 | - return Flatted::loop(true, Flatted::keys($value), $input, $set, $value); |
|
42 | + if (is_array($value)) { |
|
43 | + return Flatted::loop(false, array_keys($value), $input, $set, $value); |
|
44 | + } |
|
45 | + if (is_object($value)) { |
|
46 | + return Flatted::loop(true, Flatted::keys($value), $input, $set, $value); |
|
47 | + } |
|
46 | 48 | return $value; |
47 | 49 | } |
48 | 50 | |
@@ -77,16 +79,18 @@ discard block |
||
77 | 79 | $obj = new ReflectionObject($value); |
78 | 80 | $props = $obj->getProperties(); |
79 | 81 | $keys = array(); |
80 | - foreach ($props as $prop) |
|
81 | - $keys[] = $prop->getName(); |
|
82 | + foreach ($props as $prop) { |
|
83 | + $keys[] = $prop->getName(); |
|
84 | + } |
|
82 | 85 | return $keys; |
83 | 86 | } |
84 | 87 | |
85 | 88 | private static function loop($obj, $keys, &$input, &$set, &$output) { |
86 | 89 | foreach ($keys as $key) { |
87 | 90 | $value = $obj ? $output->$key : $output[$key]; |
88 | - if ($value instanceof FlattedString) |
|
89 | - Flatted::ref($obj, $key, $input[$value->value], $input, $set, $output); |
|
91 | + if ($value instanceof FlattedString) { |
|
92 | + Flatted::ref($obj, $key, $input[$value->value], $input, $set, $output); |
|
93 | + } |
|
90 | 94 | } |
91 | 95 | return $output; |
92 | 96 | } |
@@ -94,8 +98,9 @@ discard block |
||
94 | 98 | private static function relate(&$known, &$input, &$value) { |
95 | 99 | if (is_string($value) || is_array($value) || is_object($value)) { |
96 | 100 | $key = array_search($value, $known->key, true); |
97 | - if ($key !== false) |
|
98 | - return $known->value[$key]; |
|
101 | + if ($key !== false) { |
|
102 | + return $known->value[$key]; |
|
103 | + } |
|
99 | 104 | return Flatted::index($known, $input, $value); |
100 | 105 | } |
101 | 106 | return $value; |
@@ -105,15 +110,13 @@ discard block |
||
105 | 110 | if (is_array($value) && !in_array($value, $set, true)) { |
106 | 111 | $set[] = $value; |
107 | 112 | $value = Flatted::loop(false, array_keys($value), $input, $set, $value); |
108 | - } |
|
109 | - elseif (is_object($value) && !in_array($value, $set, true)) { |
|
113 | + } elseif (is_object($value) && !in_array($value, $set, true)) { |
|
110 | 114 | $set[] = $value; |
111 | 115 | $value = Flatted::loop(true, Flatted::keys($value), $input, $set, $value); |
112 | 116 | } |
113 | 117 | if ($obj) { |
114 | 118 | $output->$key = &$value; |
115 | - } |
|
116 | - else { |
|
119 | + } else { |
|
117 | 120 | $output[$key] = &$value; |
118 | 121 | } |
119 | 122 | } |
@@ -130,8 +133,9 @@ discard block |
||
130 | 133 | if (is_object($value)) { |
131 | 134 | $object = new stdClass; |
132 | 135 | $keys = Flatted::keys($value); |
133 | - foreach ($keys as $key) |
|
134 | - $object->$key = Flatted::relate($known, $input, $value->$key); |
|
136 | + foreach ($keys as $key) { |
|
137 | + $object->$key = Flatted::relate($known, $input, $value->$key); |
|
138 | + } |
|
135 | 139 | return $object; |
136 | 140 | } |
137 | 141 | return $value; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function up() |
23 | 23 | { |
24 | - Schema::create(config('admin.database.users_table'), function (Blueprint $table) { |
|
24 | + Schema::create(config('admin.database.users_table'), function(Blueprint $table) { |
|
25 | 25 | $table->id(); |
26 | 26 | $table->string('username', 190)->unique(); |
27 | 27 | $table->string('password', 60); |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | $table->timestamps(); |
32 | 32 | }); |
33 | 33 | |
34 | - Schema::create(config('admin.database.roles_table'), function (Blueprint $table) { |
|
34 | + Schema::create(config('admin.database.roles_table'), function(Blueprint $table) { |
|
35 | 35 | $table->id(); |
36 | 36 | $table->string('name', 50)->unique(); |
37 | 37 | $table->string('slug', 50)->unique(); |
38 | 38 | $table->timestamps(); |
39 | 39 | }); |
40 | 40 | |
41 | - Schema::create(config('admin.database.permissions_table'), function (Blueprint $table) { |
|
41 | + Schema::create(config('admin.database.permissions_table'), function(Blueprint $table) { |
|
42 | 42 | $table->id(); |
43 | 43 | $table->string('name', 50)->unique(); |
44 | 44 | $table->string('slug', 50)->unique(); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $table->timestamps(); |
48 | 48 | }); |
49 | 49 | |
50 | - Schema::create(config('admin.database.menu_table'), function (Blueprint $table) { |
|
50 | + Schema::create(config('admin.database.menu_table'), function(Blueprint $table) { |
|
51 | 51 | $table->id(); |
52 | 52 | $table->integer('parent_id')->default(0); |
53 | 53 | $table->integer('order')->default(0); |
@@ -59,35 +59,35 @@ discard block |
||
59 | 59 | $table->timestamps(); |
60 | 60 | }); |
61 | 61 | |
62 | - Schema::create(config('admin.database.role_users_table'), function (Blueprint $table) { |
|
62 | + Schema::create(config('admin.database.role_users_table'), function(Blueprint $table) { |
|
63 | 63 | $table->foreignId('role_id')->constrained(config('admin.database.roles_table'))->onDelete('cascade'); |
64 | 64 | $table->foreignId('user_id')->constrained(config('admin.database.users_table'))->onDelete('cascade'); |
65 | 65 | $table->index(['role_id', 'user_id']); |
66 | 66 | $table->timestamps(); |
67 | 67 | }); |
68 | 68 | |
69 | - Schema::create(config('admin.database.role_permissions_table'), function (Blueprint $table) { |
|
69 | + Schema::create(config('admin.database.role_permissions_table'), function(Blueprint $table) { |
|
70 | 70 | $table->foreignId('role_id')->constrained(config('admin.database.roles_table'))->onDelete('cascade'); |
71 | 71 | $table->foreignId('permission_id')->constrained(config('admin.database.permissions_table'))->onDelete('cascade'); |
72 | 72 | $table->index(['role_id', 'permission_id']); |
73 | 73 | $table->timestamps(); |
74 | 74 | }); |
75 | 75 | |
76 | - Schema::create(config('admin.database.user_permissions_table'), function (Blueprint $table) { |
|
76 | + Schema::create(config('admin.database.user_permissions_table'), function(Blueprint $table) { |
|
77 | 77 | $table->foreignId('user_id')->constrained(config('admin.database.users_table'))->onDelete('cascade'); |
78 | 78 | $table->foreignId('permission_id')->constrained(config('admin.database.permissions_table'))->onDelete('cascade'); |
79 | 79 | $table->index(['user_id', 'permission_id']); |
80 | 80 | $table->timestamps(); |
81 | 81 | }); |
82 | 82 | |
83 | - Schema::create(config('admin.database.role_menu_table'), function (Blueprint $table) { |
|
83 | + Schema::create(config('admin.database.role_menu_table'), function(Blueprint $table) { |
|
84 | 84 | $table->foreignId('role_id')->constrained(config('admin.database.roles_table'))->onDelete('cascade'); |
85 | 85 | $table->foreignId('menu_id')->constrained(config('admin.database.menu_table'))->onDelete('cascade'); |
86 | 86 | $table->index(['role_id', 'menu_id']); |
87 | 87 | $table->timestamps(); |
88 | 88 | }); |
89 | 89 | |
90 | - Schema::create(config('admin.database.operation_log_table'), function (Blueprint $table) { |
|
90 | + Schema::create(config('admin.database.operation_log_table'), function(Blueprint $table) { |
|
91 | 91 | $table->id(); |
92 | 92 | $table->foreignId('user_id')->constrained(config('admin.database.users_table'))->onDelete('cascade'); |
93 | 93 | $table->string('path'); |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | |
455 | 455 | try { |
456 | 456 | return Vite::useBuildDirectory(config('admin.vite.build_path', 'build')) |
457 | - ->withEntryPoints(static::$viteAssets['css']) |
|
458 | - ->toHtml(); |
|
457 | + ->withEntryPoints(static::$viteAssets['css']) |
|
458 | + ->toHtml(); |
|
459 | 459 | } catch (\Exception $e) { |
460 | 460 | // Fallback to legacy assets if Vite fails |
461 | 461 | return ''; |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | |
476 | 476 | try { |
477 | 477 | return Vite::useBuildDirectory(config('admin.vite.build_path', 'build')) |
478 | - ->withEntryPoints(static::$viteAssets['js']) |
|
479 | - ->toHtml(); |
|
478 | + ->withEntryPoints(static::$viteAssets['js']) |
|
479 | + ->toHtml(); |
|
480 | 480 | } catch (\Exception $e) { |
481 | 481 | // Fallback to legacy assets if Vite fails |
482 | 482 | return ''; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public static function useVite() |
73 | 73 | { |
74 | 74 | return config('admin.assets.use_vite', false) && |
75 | - file_exists(public_path(config('admin.assets.vite_build_path', 'build') . '/manifest.json')); |
|
75 | + file_exists(public_path(config('admin.assets.vite_build_path', 'build').'/manifest.json')); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $script = collect(static::$script) |
260 | 260 | ->merge(static::$deferredScript) |
261 | 261 | ->unique() |
262 | - ->map(function ($line) { |
|
262 | + ->map(function($line) { |
|
263 | 263 | return $line; |
264 | 264 | //@see https://stackoverflow.com/questions/19509863/how-to-remove-js-comments-using-php |
265 | 265 | $pattern = '/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\')\/\/.*))/'; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $style = collect(static::$style) |
286 | 286 | ->unique() |
287 | - ->map(function ($line) { |
|
287 | + ->map(function($line) { |
|
288 | 288 | return preg_replace('/\s+/', ' ', $line); |
289 | 289 | }); |
290 | 290 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | |
502 | 502 | $script = " |
503 | 503 | // AdminLTE 4 + Bootstrap 5 Initialization |
504 | - window.AdminConfig = " . json_encode($config) . "; |
|
504 | + window.AdminConfig = " . json_encode($config)."; |
|
505 | 505 | |
506 | 506 | // Initialize theme on page load |
507 | 507 | document.addEventListener('DOMContentLoaded', function() { |