Skip to content

Commit e9e4b19

Browse files
authored
Merge pull request #152 from code16/fix/add-generator-for-list-command
Add instance make command
2 parents 3341e03 + 32ddfad commit e9e4b19

File tree

6 files changed

+79
-6
lines changed

6 files changed

+79
-6
lines changed

src/Console/DashboardMakeCommand.php

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

55
use Illuminate\Console\GeneratorCommand;
6-
use Symfony\Component\Console\Input\InputOption;
76

87
class DashboardMakeCommand extends GeneratorCommand
98
{
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
namespace Code16\Sharp\Console;
44

5-
use Illuminate\Support\Str;
65
use Illuminate\Console\GeneratorCommand;
7-
use Symfony\Component\Console\Input\InputOption;
86

9-
class CommandMakeCommand extends GeneratorCommand
7+
class EntityCommandMakeCommand extends GeneratorCommand
108
{
119
/**
1210
* The console command name.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace Code16\Sharp\Console;
4+
5+
use Illuminate\Console\GeneratorCommand;
6+
7+
class InstanceCommandMakeCommand extends GeneratorCommand
8+
{
9+
/**
10+
* The console command name.
11+
*
12+
* @var string
13+
*/
14+
protected $name = 'sharp:make:instance-command';
15+
16+
/**
17+
* The console command description.
18+
*
19+
* @var string
20+
*/
21+
protected $description = 'Create a new instance command class';
22+
23+
/**
24+
* The type of class being generated.
25+
*
26+
* @var string
27+
*/
28+
protected $type = 'InstanceCommand';
29+
30+
/**
31+
* Get the stub file for the generator.
32+
*
33+
* @return string
34+
*/
35+
protected function getStub()
36+
{
37+
return __DIR__.'/stubs/instance-command.stub';
38+
}
39+
40+
/**
41+
* Get the default namespace for the class.
42+
*
43+
* @param string $rootNamespace
44+
* @return string
45+
*/
46+
protected function getDefaultNamespace($rootNamespace)
47+
{
48+
return $rootNamespace.'\Sharp';
49+
}
50+
}

src/Console/ListFilterMakeCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Code16\Sharp\Console;
44

5-
use Illuminate\Support\Str;
65
use Illuminate\Console\GeneratorCommand;
76
use Symfony\Component\Console\Input\InputOption;
87

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace DummyNamespace;
4+
5+
use Code16\Sharp\EntityList\Commands\InstanceCommand;
6+
7+
class DummyClass extends InstanceCommand
8+
{
9+
/**
10+
* @return string
11+
*/
12+
public function label(): string
13+
{
14+
//
15+
}
16+
17+
/**
18+
* @param string $instanceId
19+
* @param array $data
20+
* @return array
21+
*/
22+
public function execute($instanceId, array $data = []): array
23+
{
24+
//
25+
}
26+
}

src/SharpServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public function register()
8383
\Code16\Sharp\Console\MediaMakeCommand::class,
8484
\Code16\Sharp\Console\PolicyMakeCommand::class,
8585
\Code16\Sharp\Console\ModelWizardCommand::class,
86-
\Code16\Sharp\Console\CommandMakeCommand::class,
86+
\Code16\Sharp\Console\EntityCommandMakeCommand::class,
87+
\Code16\Sharp\Console\InstanceCommandMakeCommand::class,
8788
\Code16\Sharp\Console\DashboardMakeCommand::class,
8889
\Code16\Sharp\Console\ValidatorMakeCommand::class,
8990
\Code16\Sharp\Console\ListFilterMakeCommand::class,

0 commit comments

Comments
 (0)