You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Commands/AliasCommand.php
+26-15Lines changed: 26 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -13,29 +13,25 @@ class AliasCommand extends Command
13
13
{name? : The name of the alias}
14
14
{line? : The command line to be aliased}
15
15
{--list : list all alias defined}
16
-
{--g|global : Add alias globally [`~/.laravel_alias`]}
17
-
{--force : Force alias to be replaced}';
16
+
{--force : Force alias to be replaced}
17
+
{--g|global : Add alias globally [`~/.laravel_alias`]}';
18
18
19
19
protected$description = 'Create an alias of another command.';
20
20
21
21
publicfunctionhandle()
22
22
{
23
-
if (empty($this->argument('name'))
24
-
orempty($this->argument('line'))
25
-
or$this->option('list')
26
-
) {
27
-
$this->handleList();
28
-
exit;
23
+
if (empty($this->argument('name')) or$this->option('list')) {
24
+
return$this->listAliases();
29
25
}
30
26
31
-
Alias::store(
32
-
trim($this->argument('name')),
33
-
trim($this->argument('line')),
34
-
$this->option('global')
35
-
);
27
+
if (! empty($this->argument('line'))) {
28
+
return$this->storeAlias();
29
+
}
30
+
31
+
return$this->listAliases();
36
32
}
37
33
38
-
privatefunctionhandleList()
34
+
privatefunctionlistAliases()
39
35
{
40
36
$list = Alias::load();
41
37
@@ -59,4 +55,19 @@ private function handleList()
59
55
$this->getOutput()->block('All aliases are currently disabled, to enable set `enabled = true` in your config file to use them.', 'Notice', 'fg=black;bg=yellow', '! ', true);
0 commit comments