Skip to content
This repository was archived by the owner on Nov 11, 2022. It is now read-only.

Commit ef2486f

Browse files
committed
wip
1 parent 1a00972 commit ef2486f

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/Console/Concerns/InteractsWithConsoleCommands.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ trait InteractsWithConsoleCommands
1616
*/
1717
public function loopThroughNameArgumentWith(string $command): bool
1818
{
19-
collect($this->argument('name'))->each(function ($name, $key) use ($command) {
19+
/**
20+
* @var array $models
21+
*/
22+
$models = explode(' ', strval($this->argument('name')));
23+
24+
collect($models)->each(function ($name) use ($command) {
2025
$this->line("Generating {$name} class\n");
2126

2227
$this->call(
@@ -37,18 +42,6 @@ public function loopThroughNameArgumentWith(string $command): bool
3742
return true;
3843
}
3944

40-
/**
41-
* Get the console command arguments.
42-
*
43-
* @return array
44-
*/
45-
protected function getArguments(): array
46-
{
47-
return [
48-
['name', InputArgument::IS_ARRAY, 'The name of the class'],
49-
];
50-
}
51-
5245
/**
5346
* Get the list of options
5447
*

tests/Commands/ModelMakeCommandTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
<?php
22

3+
it('creates a new eloquent single model class', function () {
4+
$this->artisan('laracommand:make-model', [
5+
'name' => 'Category',
6+
])
7+
->assertExitCode(0);
8+
});
9+
10+
it('returns required error if the name was not provided', function () {
11+
$this->artisan('laracommand:make-model', [
12+
'name' => null,
13+
])
14+
->assertExitCode(0);
15+
});
16+
317
it('creates a new eloquent model class', function () {
418
$this->artisan('laracommand:make-model', [
519
'name' => 'Category Product',

0 commit comments

Comments
 (0)