99use Illuminate \Foundation \Validation \ValidatesRequests ;
1010use Illuminate \Routing \Controller ;
1111use Illuminate \Support \Facades \Artisan ;
12+ use Illuminate \Support \Facades \Gate ;
13+ use Illuminate \Support \Str ;
1214use Symfony \Component \Console \Command \Command ;
1315use Symfony \Component \Console \Input \InputArgument ;
1416use Symfony \Component \Console \Input \InputOption ;
@@ -31,7 +33,7 @@ function run($command) {
3133
3234 $ permissions = config ('artisan-gui.permissions ' , []);
3335
34- if (in_array ($ command ->getName (), array_keys ($ permissions )) && !\ Gate::check ($ permissions [$ command ->getName ()]))
36+ if (in_array ($ command ->getName (), array_keys ($ permissions )) && !Gate::check ($ permissions [$ command ->getName ()]))
3537 abort (403 );
3638
3739 $ rules = $ this ->buildRules ($ command );
@@ -81,7 +83,7 @@ protected function prepareToJson(array $commands): array {
8183 foreach ($ commands as $ gKey => $ group ) {
8284 foreach ($ group as $ cKey => $ command ) {
8385
84- if (($ permission = $ permissions [$ command ] ?? null ) && !\ Gate::check ($ permission )) {
86+ if (($ permission = $ permissions [$ command ] ?? null ) && !Gate::check ($ permission )) {
8587 unset($ commands [$ gKey ][$ cKey ]);
8688 continue ;
8789 }
@@ -126,7 +128,7 @@ protected function optionsToArray(Command $command): ?array {
126128
127129 $ options = array_map (function (InputOption $ option ) {
128130 return [
129- 'title ' => \ Str::of ($ option ->getName ())->snake ()->replace ('_ ' , ' ' )->title ()->__toString (),
131+ 'title ' => Str::of ($ option ->getName ())->snake ()->replace ('_ ' , ' ' )->title ()->__toString (),
130132 'name ' => $ option ->getName (),
131133 'description ' => $ option ->getDescription (),
132134 'shortcut ' => $ option ->getShortcut (),
@@ -144,7 +146,7 @@ protected function argumentsToArray(Command $command): ?array {
144146 $ definition = $ command ->getDefinition ();
145147 $ arguments = array_map (function (InputArgument $ argument ) {
146148 return [
147- 'title ' => \ Str::of ($ argument ->getName ())->snake ()->replace ('_ ' , ' ' )->title ()->__toString (),
149+ 'title ' => Str::of ($ argument ->getName ())->snake ()->replace ('_ ' , ' ' )->title ()->__toString (),
148150 'name ' => $ argument ->getName (),
149151 'description ' => $ argument ->getDescription (),
150152 'default ' => empty ($ default = $ argument ->getDefault ()) ? null : $ default ,
@@ -158,7 +160,7 @@ protected function argumentsToArray(Command $command): ?array {
158160
159161 protected function renameKeys (array $ array ): array {
160162 $ keys = array_map (function ($ key ) {
161- return \ Str::title ($ key );
163+ return Str::title ($ key );
162164 }, array_keys ($ array ));
163165
164166 return array_combine ($ keys , array_values ($ array ));
@@ -192,4 +194,4 @@ protected function buildRules(Command $command) {
192194 return $ rules ;
193195 }
194196
195- }
197+ }
0 commit comments