Skip to content

Commit 952ee9a

Browse files
author
Andrey Helldar
committed
Fixed It seems like $this->argument('name') can also be of type string[]
1 parent f50f4d2 commit 952ee9a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Console/Make.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Helldar\LaravelActions\Console;
44

55
use Helldar\LaravelActions\Constants\Names;
6+
use Helldar\LaravelActions\Traits\Argumentable;
67
use Helldar\LaravelActions\Traits\Database;
78
use Helldar\LaravelActions\Traits\Infoable;
89
use Illuminate\Database\Console\Migrations\BaseCommand;
@@ -12,6 +13,7 @@
1213

1314
final class Make extends BaseCommand
1415
{
16+
use Argumentable;
1517
use Database;
1618
use Infoable;
1719

@@ -66,7 +68,7 @@ public function __construct(MigrationCreator $creator, Composer $composer)
6668
public function handle()
6769
{
6870
$this->writeMigration(
69-
Str::snake(trim($this->argument('name')))
71+
Str::snake($this->argumentName())
7072
);
7173

7274
$this->composer->dumpAutoloads();

src/Traits/Argumentable.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Helldar\LaravelActions\Traits;
4+
5+
/** @mixin \Illuminate\Console\Command */
6+
trait Argumentable
7+
{
8+
protected function argumentName(): string
9+
{
10+
$value = (string) $this->argument('name');
11+
12+
return trim($value);
13+
}
14+
}

0 commit comments

Comments
 (0)