@@ -6,26 +6,26 @@ discard block |
||
6 | 6 | |
7 | 7 | class DatabaseConnectionCommand extends Command |
8 | 8 | { |
9 | - /** |
|
10 | - * The name and signature of the console command. |
|
11 | - * |
|
12 | - * @var string |
|
13 | - */ |
|
14 | - protected $signature = 'epesi:database-connection {--connection= : DB connection settings}'; |
|
9 | + /** |
|
10 | + * The name and signature of the console command. |
|
11 | + * |
|
12 | + * @var string |
|
13 | + */ |
|
14 | + protected $signature = 'epesi:database-connection {--connection= : DB connection settings}'; |
|
15 | 15 | |
16 | - /** |
|
17 | - * The console command description. |
|
18 | - * |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - protected $description = 'Update database connection for epesi application'; |
|
16 | + /** |
|
17 | + * The console command description. |
|
18 | + * |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + protected $description = 'Update database connection for epesi application'; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Execute the console command. |
|
25 | - */ |
|
26 | - public function handle() |
|
27 | - { |
|
28 | - $connection = $this->option('connection'); |
|
23 | + /** |
|
24 | + * Execute the console command. |
|
25 | + */ |
|
26 | + public function handle() |
|
27 | + { |
|
28 | + $connection = $this->option('connection'); |
|
29 | 29 | |
30 | 30 | $map = [ |
31 | 31 | 'driver' => 'DB_CONNECTION', |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | return; |
49 | 49 | } |
50 | 50 | |
51 | - $this->call('epesi:env', [ |
|
52 | - 'name' => $env |
|
53 | - ]); |
|
51 | + $this->call('epesi:env', [ |
|
52 | + 'name' => $env |
|
53 | + ]); |
|
54 | 54 | |
55 | - $this->comment('DB connection settings updated!'); |
|
56 | - } |
|
55 | + $this->comment('DB connection settings updated!'); |
|
56 | + } |
|
57 | 57 | } |
@@ -38,7 +38,9 @@ |
||
38 | 38 | |
39 | 39 | $env = []; |
40 | 40 | foreach ($map as $key => $name) { |
41 | - if (!isset($connection[$key])) continue; |
|
41 | + if (!isset($connection[$key])) { |
|
42 | + continue; |
|
43 | + } |
|
42 | 44 | |
43 | 45 | $env[$name] = $connection[$key]; |
44 | 46 | } |
@@ -7,33 +7,33 @@ |
||
7 | 7 | |
8 | 8 | class ModuleInstallCommand extends Command |
9 | 9 | { |
10 | - /** |
|
11 | - * The name and signature of the console command. |
|
12 | - * |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $signature = 'epesi:module-install {module : The class name or alias of the module.}'; |
|
10 | + /** |
|
11 | + * The name and signature of the console command. |
|
12 | + * |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $signature = 'epesi:module-install {module : The class name or alias of the module.}'; |
|
16 | 16 | |
17 | - /** |
|
18 | - * The console command description. |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - protected $description = 'Install the epesi module'; |
|
17 | + /** |
|
18 | + * The console command description. |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + protected $description = 'Install the epesi module'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Execute the console command. |
|
26 | - */ |
|
27 | - public function handle() |
|
28 | - { |
|
29 | - try { |
|
30 | - ob_start(); |
|
31 | - ModuleManager::install($this->argument('module')); |
|
24 | + /** |
|
25 | + * Execute the console command. |
|
26 | + */ |
|
27 | + public function handle() |
|
28 | + { |
|
29 | + try { |
|
30 | + ob_start(); |
|
31 | + ModuleManager::install($this->argument('module')); |
|
32 | 32 | |
33 | - $this->alert(ob_get_clean()); |
|
34 | - } catch (\Exception $e) { |
|
35 | - $this->error($e->getMessage()); |
|
36 | - } |
|
37 | - } |
|
33 | + $this->alert(ob_get_clean()); |
|
34 | + } catch (\Exception $e) { |
|
35 | + $this->error($e->getMessage()); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | 39 | } |
@@ -8,58 +8,58 @@ |
||
8 | 8 | |
9 | 9 | class DatabaseCreateCommand extends Command |
10 | 10 | { |
11 | - /** |
|
12 | - * The name and signature of the console command. |
|
13 | - * |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $signature = 'epesi:database-create {name : The name of the database.} |
|
11 | + /** |
|
12 | + * The name and signature of the console command. |
|
13 | + * |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $signature = 'epesi:database-create {name : The name of the database.} |
|
17 | 17 | {--connection=mysql DB connection settings}'; |
18 | 18 | |
19 | - /** |
|
20 | - * The console command description. |
|
21 | - * |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - protected $description = 'Create database for the epesi application'; |
|
19 | + /** |
|
20 | + * The console command description. |
|
21 | + * |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + protected $description = 'Create database for the epesi application'; |
|
25 | 25 | |
26 | - protected $connection; |
|
26 | + protected $connection; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Execute the console command. |
|
30 | - */ |
|
31 | - public function handle() |
|
32 | - { |
|
33 | - DB::connection($this->connection())->statement('CREATE DATABASE `' . $this->argument('name') . '`'); |
|
34 | - } |
|
28 | + /** |
|
29 | + * Execute the console command. |
|
30 | + */ |
|
31 | + public function handle() |
|
32 | + { |
|
33 | + DB::connection($this->connection())->statement('CREATE DATABASE `' . $this->argument('name') . '`'); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Creates the configuration for the connection and returns the key |
|
38 | - * |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - protected function connection() |
|
42 | - { |
|
43 | - $connection = $this->option('connection'); |
|
36 | + /** |
|
37 | + * Creates the configuration for the connection and returns the key |
|
38 | + * |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + protected function connection() |
|
42 | + { |
|
43 | + $connection = $this->option('connection'); |
|
44 | 44 | |
45 | - // Just get access to the config. |
|
46 | - $config = App::make('config'); |
|
45 | + // Just get access to the config. |
|
46 | + $config = App::make('config'); |
|
47 | 47 | |
48 | - // Will contain the array of connections that appear in our database config file. |
|
49 | - $connections = $config->get('database.connections'); |
|
48 | + // Will contain the array of connections that appear in our database config file. |
|
49 | + $connections = $config->get('database.connections'); |
|
50 | 50 | |
51 | - $driver = is_string($connection)? $connection: $connection['driver']; |
|
51 | + $driver = is_string($connection)? $connection: $connection['driver']; |
|
52 | 52 | |
53 | - $defaultConnection = $connections[$driver]?? $connections[$config->get('database.default')]; |
|
53 | + $defaultConnection = $connections[$driver]?? $connections[$config->get('database.default')]; |
|
54 | 54 | |
55 | - $newConnection = array_merge($defaultConnection, is_string($connection)? []: $connection); |
|
55 | + $newConnection = array_merge($defaultConnection, is_string($connection)? []: $connection); |
|
56 | 56 | |
57 | - // Do not select database |
|
58 | - $newConnection['database'] = ''; |
|
57 | + // Do not select database |
|
58 | + $newConnection['database'] = ''; |
|
59 | 59 | |
60 | - // This will add our new connection to the run-time configuration for the duration of the request. |
|
61 | - $config->set('database.connections.create-db', $newConnection); |
|
60 | + // This will add our new connection to the run-time configuration for the duration of the request. |
|
61 | + $config->set('database.connections.create-db', $newConnection); |
|
62 | 62 | |
63 | - return 'create-db'; |
|
64 | - } |
|
63 | + return 'create-db'; |
|
64 | + } |
|
65 | 65 | } |
@@ -48,11 +48,11 @@ |
||
48 | 48 | // Will contain the array of connections that appear in our database config file. |
49 | 49 | $connections = $config->get('database.connections'); |
50 | 50 | |
51 | - $driver = is_string($connection)? $connection: $connection['driver']; |
|
51 | + $driver = is_string($connection) ? $connection : $connection['driver']; |
|
52 | 52 | |
53 | 53 | $defaultConnection = $connections[$driver]?? $connections[$config->get('database.default')]; |
54 | 54 | |
55 | - $newConnection = array_merge($defaultConnection, is_string($connection)? []: $connection); |
|
55 | + $newConnection = array_merge($defaultConnection, is_string($connection) ? [] : $connection); |
|
56 | 56 | |
57 | 57 | // Do not select database |
58 | 58 | $newConnection['database'] = ''; |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | |
9 | 9 | class EpesiCommand extends Command |
10 | 10 | { |
11 | - /** |
|
12 | - * The name and signature of the console command. |
|
13 | - * |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $signature = 'epesi'; |
|
17 | - |
|
18 | - /** |
|
19 | - * The console command description. |
|
20 | - * |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $description = 'List all epesi commands'; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - public static $logo = <<<LOGO |
|
11 | + /** |
|
12 | + * The name and signature of the console command. |
|
13 | + * |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $signature = 'epesi'; |
|
17 | + |
|
18 | + /** |
|
19 | + * The console command description. |
|
20 | + * |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $description = 'List all epesi commands'; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + public static $logo = <<<LOGO |
|
29 | 29 | ____ ____ ____ ____ __ |
30 | 30 | ( __)( _ \( __)/ ___)( ) |
31 | 31 | ) _) ) __/ ) _) \___ \ )( |
@@ -33,74 +33,74 @@ discard block |
||
33 | 33 | |
34 | 34 | LOGO; |
35 | 35 | |
36 | - /** |
|
37 | - * Execute the console command. |
|
38 | - */ |
|
39 | - public function handle() |
|
40 | - { |
|
41 | - $this->line(static::$logo); |
|
42 | - |
|
43 | - $this->comment(''); |
|
44 | - $this->comment('Available commands:'); |
|
45 | - |
|
46 | - $this->listEpesiCommands(); |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * List all epesi commands. |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - protected function listEpesiCommands() |
|
55 | - { |
|
56 | - $commands = collect(Artisan::all())->mapWithKeys(function ($command, $key) { |
|
57 | - if (Str::startsWith($key, 'epesi:')) { |
|
58 | - return [$key => $command]; |
|
59 | - } |
|
60 | - |
|
61 | - return []; |
|
62 | - })->toArray(); |
|
63 | - |
|
64 | - $width = $this->getColumnWidth($commands); |
|
65 | - |
|
66 | - /** @var Command $command */ |
|
67 | - foreach ($commands as $command) { |
|
68 | - $this->line(sprintf(" %-{$width}s %s", $command->getName(), $command->getDescription())); |
|
69 | - } |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * @param (Command|string)[] $commands |
|
74 | - * |
|
75 | - * @return int |
|
76 | - */ |
|
77 | - private function getColumnWidth(array $commands) |
|
78 | - { |
|
79 | - $widths = []; |
|
80 | - |
|
81 | - foreach ($commands as $command) { |
|
82 | - $widths[] = static::strlen($command->getName()); |
|
83 | - foreach ($command->getAliases() as $alias) { |
|
84 | - $widths[] = static::strlen($alias); |
|
85 | - } |
|
86 | - } |
|
87 | - |
|
88 | - return $widths ? max($widths) + 2 : 0; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Returns the length of a string, using mb_strwidth if it is available. |
|
93 | - * |
|
94 | - * @param string $string The string to check its length |
|
95 | - * |
|
96 | - * @return int The length of the string |
|
97 | - */ |
|
98 | - public static function strlen($string) |
|
99 | - { |
|
100 | - if (false === $encoding = mb_detect_encoding($string, null, true)) { |
|
101 | - return strlen($string); |
|
102 | - } |
|
103 | - |
|
104 | - return mb_strwidth($string, $encoding); |
|
105 | - } |
|
36 | + /** |
|
37 | + * Execute the console command. |
|
38 | + */ |
|
39 | + public function handle() |
|
40 | + { |
|
41 | + $this->line(static::$logo); |
|
42 | + |
|
43 | + $this->comment(''); |
|
44 | + $this->comment('Available commands:'); |
|
45 | + |
|
46 | + $this->listEpesiCommands(); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * List all epesi commands. |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + protected function listEpesiCommands() |
|
55 | + { |
|
56 | + $commands = collect(Artisan::all())->mapWithKeys(function ($command, $key) { |
|
57 | + if (Str::startsWith($key, 'epesi:')) { |
|
58 | + return [$key => $command]; |
|
59 | + } |
|
60 | + |
|
61 | + return []; |
|
62 | + })->toArray(); |
|
63 | + |
|
64 | + $width = $this->getColumnWidth($commands); |
|
65 | + |
|
66 | + /** @var Command $command */ |
|
67 | + foreach ($commands as $command) { |
|
68 | + $this->line(sprintf(" %-{$width}s %s", $command->getName(), $command->getDescription())); |
|
69 | + } |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * @param (Command|string)[] $commands |
|
74 | + * |
|
75 | + * @return int |
|
76 | + */ |
|
77 | + private function getColumnWidth(array $commands) |
|
78 | + { |
|
79 | + $widths = []; |
|
80 | + |
|
81 | + foreach ($commands as $command) { |
|
82 | + $widths[] = static::strlen($command->getName()); |
|
83 | + foreach ($command->getAliases() as $alias) { |
|
84 | + $widths[] = static::strlen($alias); |
|
85 | + } |
|
86 | + } |
|
87 | + |
|
88 | + return $widths ? max($widths) + 2 : 0; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Returns the length of a string, using mb_strwidth if it is available. |
|
93 | + * |
|
94 | + * @param string $string The string to check its length |
|
95 | + * |
|
96 | + * @return int The length of the string |
|
97 | + */ |
|
98 | + public static function strlen($string) |
|
99 | + { |
|
100 | + if (false === $encoding = mb_detect_encoding($string, null, true)) { |
|
101 | + return strlen($string); |
|
102 | + } |
|
103 | + |
|
104 | + return mb_strwidth($string, $encoding); |
|
105 | + } |
|
106 | 106 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | protected function listEpesiCommands() |
55 | 55 | { |
56 | - $commands = collect(Artisan::all())->mapWithKeys(function ($command, $key) { |
|
56 | + $commands = collect(Artisan::all())->mapWithKeys(function($command, $key) { |
|
57 | 57 | if (Str::startsWith($key, 'epesi:')) { |
58 | 58 | return [$key => $command]; |
59 | 59 | } |
@@ -67,7 +67,9 @@ discard block |
||
67 | 67 | |
68 | 68 | public function addGroupResults($group, $testResults = [], $container = null) |
69 | 69 | { |
70 | - if (! $testResults) return; |
|
70 | + if (! $testResults) { |
|
71 | + return; |
|
72 | + } |
|
71 | 73 | |
72 | 74 | $container = $container?: $this; |
73 | 75 | |
@@ -153,8 +155,7 @@ discard block |
||
153 | 155 | $severity = 0; |
154 | 156 | if ($actualSizeBytes < $requiredSizeBytes) { |
155 | 157 | $severity = 2; |
156 | - } |
|
157 | - elseif ($actualSizeBytes == $requiredSizeBytes) { |
|
158 | + } elseif ($actualSizeBytes == $requiredSizeBytes) { |
|
158 | 159 | $severity = 1; |
159 | 160 | } |
160 | 161 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function addLegend($container = null) |
89 | 89 | { |
90 | - $container = $container?: $this; |
|
90 | + $container = $container ?: $this; |
|
91 | 91 | |
92 | 92 | $legend = $container->add(['Header', __('Scan of Environment Parameters')])->setStyle('margin-left', '2em'); |
93 | 93 | $legend = $container->add('View')->setStyle('margin-left', 'auto'); |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | |
100 | 100 | public function addGroupResults($group, $testResults = [], $container = null) |
101 | 101 | { |
102 | - if (! $testResults) return; |
|
102 | + if (!$testResults) return; |
|
103 | 103 | |
104 | - $container = $container?: $this; |
|
104 | + $container = $container ?: $this; |
|
105 | 105 | |
106 | 106 | $container->add(['Header', $group]); |
107 | 107 | |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | |
124 | 124 | @Schema::dropIfExists('test'); |
125 | 125 | |
126 | - @Schema::create('test', function (Blueprint $table) { |
|
126 | + @Schema::create('test', function(Blueprint $table) { |
|
127 | 127 | $table->increments('id'); |
128 | 128 | }); |
129 | 129 | |
130 | 130 | $create = Schema::hasTable('test'); |
131 | 131 | |
132 | - @Schema::table('test', function (Blueprint $table) { |
|
132 | + @Schema::table('test', function(Blueprint $table) { |
|
133 | 133 | $table->addColumn('TEXT', 'field_name'); |
134 | 134 | }); |
135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $delete = @DB::delete('DELETE FROM test'); |
141 | 141 | @Schema::dropIfExists('test'); |
142 | 142 | |
143 | - $drop = ! Schema::hasTable('test'); |
|
143 | + $drop = !Schema::hasTable('test'); |
|
144 | 144 | |
145 | 145 | ob_end_clean(); |
146 | 146 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | array_walk($result, function(& $testResult, $testName) { |
150 | 150 | $testResult = [ |
151 | 151 | 'name' => __(':permission permission', ['permission' => strtoupper($testName)]), |
152 | - 'result' => $testResult? __('OK'): __('Failed'), |
|
153 | - 'severity' => $testResult? 0: 2 |
|
152 | + 'result' => $testResult ? __('OK') : __('Failed'), |
|
153 | + 'severity' => $testResult ? 0 : 2 |
|
154 | 154 | ]; |
155 | 155 | }); |
156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | protected function unitToInt($string) |
161 | 161 | { |
162 | - return (int) preg_replace_callback('/(\-?\d+)(.?)/', function ($m) { |
|
162 | + return (int) preg_replace_callback('/(\-?\d+)(.?)/', function($m) { |
|
163 | 163 | return $m[1] * pow(1024, strpos('BKMG', $m[2])); |
164 | 164 | }, strtoupper($string)); |
165 | 165 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $ret[] = [ |
173 | 173 | 'name' => __('PHP version required :version', ['version' => $requiredPhpVersion]), |
174 | 174 | 'result' => PHP_VERSION, |
175 | - 'severity' => version_compare(PHP_VERSION, $requiredPhpVersion, '>=')? 0: 2 |
|
175 | + 'severity' => version_compare(PHP_VERSION, $requiredPhpVersion, '>=') ? 0 : 2 |
|
176 | 176 | ]; |
177 | 177 | } |
178 | 178 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | $result = $callback($extension); |
209 | 209 | |
210 | 210 | $ret[] = array_merge($test, [ |
211 | - 'result' => $result? __('OK'): __('Missing'), |
|
212 | - 'severity' => $result? 0: $test['severity'] |
|
211 | + 'result' => $result ? __('OK') : __('Missing'), |
|
212 | + 'severity' => $result ? 0 : $test['severity'] |
|
213 | 213 | ]); |
214 | 214 | } |
215 | 215 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $this->loadMigrationsFrom(ModuleManager::collect('migrations')); |
30 | 30 | |
31 | 31 | // Publish epesi configuration files |
32 | - $this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config'); |
|
32 | + $this->publishes([__DIR__ . '/../../config' => config_path()], 'epesi.config'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -20,25 +20,25 @@ |
||
20 | 20 | ModuleInstallCommand::class |
21 | 21 | ]; |
22 | 22 | |
23 | - /** |
|
24 | - * Booting the package. |
|
25 | - */ |
|
26 | - public function boot() |
|
27 | - { |
|
28 | - $this->app->register(\JoeDixon\Translation\TranslationServiceProvider::class); |
|
23 | + /** |
|
24 | + * Booting the package. |
|
25 | + */ |
|
26 | + public function boot() |
|
27 | + { |
|
28 | + $this->app->register(\JoeDixon\Translation\TranslationServiceProvider::class); |
|
29 | 29 | |
30 | - // Register migrations from installed modules |
|
31 | - $this->loadMigrationsFrom(ModuleManager::collect('migrations')); |
|
30 | + // Register migrations from installed modules |
|
31 | + $this->loadMigrationsFrom(ModuleManager::collect('migrations')); |
|
32 | 32 | |
33 | - // Publish epesi configuration files |
|
34 | - $this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config'); |
|
35 | - } |
|
33 | + // Publish epesi configuration files |
|
34 | + $this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config'); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Register the provider. |
|
39 | - */ |
|
40 | - public function register() |
|
41 | - { |
|
42 | - $this->commands($this->commands); |
|
43 | - } |
|
37 | + /** |
|
38 | + * Register the provider. |
|
39 | + */ |
|
40 | + public function register() |
|
41 | + { |
|
42 | + $this->commands($this->commands); |
|
43 | + } |
|
44 | 44 | } |
@@ -73,7 +73,9 @@ discard block |
||
73 | 73 | { |
74 | 74 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
75 | 75 | |
76 | - if (! $entry->get('item')) return; |
|
76 | + if (! $entry->get('item')) { |
|
77 | + return; |
|
78 | + } |
|
77 | 79 | |
78 | 80 | $this->entries->add($entry); |
79 | 81 | } |
@@ -94,14 +96,18 @@ discard block |
||
94 | 96 | { |
95 | 97 | $empty = true; |
96 | 98 | foreach ($this->entries->groupBy('group')->sortKeys() as $group) { |
97 | - if (!$empty) $this->userMenu->addDivider(); |
|
99 | + if (!$empty) { |
|
100 | + $this->userMenu->addDivider(); |
|
101 | + } |
|
98 | 102 | |
99 | 103 | foreach ($group->sortBy('weight') as $entry) { |
100 | 104 | $empty = false; |
101 | 105 | |
102 | 106 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
103 | 107 | |
104 | - if (! $callback = $entry->get('callback')) continue; |
|
108 | + if (! $callback = $entry->get('callback')) { |
|
109 | + continue; |
|
110 | + } |
|
105 | 111 | |
106 | 112 | $callback($item); |
107 | 113 | } |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | 'icon' => 'th' |
40 | 40 | ], new LaunchPad($this)); |
41 | 41 | |
42 | - foreach(UserMenuJoint::collect() as $joint) { |
|
43 | - foreach ($joint->tools()?: [] as $tool) { |
|
42 | + foreach (UserMenuJoint::collect() as $joint) { |
|
43 | + foreach ($joint->tools() ?: [] as $tool) { |
|
44 | 44 | $this->addTool($tool); |
45 | 45 | } |
46 | 46 | |
47 | - foreach ($joint->entries()?: [] as $entry) { |
|
47 | + foreach ($joint->entries() ?: [] as $entry) { |
|
48 | 48 | $this->addEntry($entry); |
49 | 49 | } |
50 | 50 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
63 | 63 | 'action' => url('logout'), |
64 | 64 | 'group' => '10000:user', |
65 | - 'callback' => function ($item){ |
|
65 | + 'callback' => function($item) { |
|
66 | 66 | $logoutForm = $item->add(['View', 'attr' => ['method' => 'POST', 'action' => url('logout')]])->setElement('form')->addStyle(['display' => 'none']); |
67 | 67 | $logoutForm->id = 'logout-form'; |
68 | 68 | $logoutForm->add(['View', 'attr' => ['type' => 'hidden', 'name' => '_token', 'value' => csrf_token()]])->setElement('input'); |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | |
80 | 80 | public function getUserMenuLabel() |
81 | 81 | { |
82 | - return $this->userMenuLabel?: Auth::user()->name; |
|
82 | + return $this->userMenuLabel ?: Auth::user()->name; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function addEntry($entry) |
86 | 86 | { |
87 | 87 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
88 | 88 | |
89 | - if (! $entry->get('item')) return; |
|
89 | + if (!$entry->get('item')) return; |
|
90 | 90 | |
91 | 91 | $this->entries->add($entry); |
92 | 92 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
116 | 116 | |
117 | - if (! $callback = $entry->get('callback')) continue; |
|
117 | + if (!$callback = $entry->get('callback')) continue; |
|
118 | 118 | |
119 | 119 | $callback($item); |
120 | 120 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct($parent) |
15 | 15 | { |
16 | - $this->parent = $parent; |
|
16 | + $this->parent = $parent; |
|
17 | 17 | |
18 | 18 | parent::__construct('$(this).atkCreateModal([arg])', [ |
19 | 19 | 'arg' => [ |
@@ -25,29 +25,29 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | protected function getURL() |
28 | - { |
|
29 | - return $this->parent->add('VirtualPage')->set(Closure::fromCallable([$this, 'getContents']))->getJSURL('cut'); |
|
30 | - } |
|
28 | + { |
|
29 | + return $this->parent->add('VirtualPage')->set(Closure::fromCallable([$this, 'getContents']))->getJSURL('cut'); |
|
30 | + } |
|
31 | 31 | |
32 | - protected function getContents(VirtualPage $vp) |
|
33 | - { |
|
34 | - $vp->add([ |
|
35 | - new LaunchButton([ |
|
36 | - 'label' => 'Test Button 1', |
|
37 | - 'icon' => 'user' |
|
38 | - ]) |
|
39 | - ])->link(URL::to('/')); |
|
40 | - $vp->add([ |
|
41 | - new LaunchButton([ |
|
42 | - 'label' => 'Test Button 2', |
|
43 | - 'icon' => 'car' |
|
44 | - ]) |
|
45 | - ]); |
|
46 | - $vp->add([ |
|
47 | - new LaunchButton([ |
|
48 | - 'label' => 'Test Button 3', |
|
49 | - 'icon' => 'bus' |
|
50 | - ]) |
|
51 | - ]); |
|
52 | - } |
|
32 | + protected function getContents(VirtualPage $vp) |
|
33 | + { |
|
34 | + $vp->add([ |
|
35 | + new LaunchButton([ |
|
36 | + 'label' => 'Test Button 1', |
|
37 | + 'icon' => 'user' |
|
38 | + ]) |
|
39 | + ])->link(URL::to('/')); |
|
40 | + $vp->add([ |
|
41 | + new LaunchButton([ |
|
42 | + 'label' => 'Test Button 2', |
|
43 | + 'icon' => 'car' |
|
44 | + ]) |
|
45 | + ]); |
|
46 | + $vp->add([ |
|
47 | + new LaunchButton([ |
|
48 | + 'label' => 'Test Button 3', |
|
49 | + 'icon' => 'bus' |
|
50 | + ]) |
|
51 | + ]); |
|
52 | + } |
|
53 | 53 | } |
@@ -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 | } |