-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathShowPageMakeCommand.php
50 lines (40 loc) · 1.17 KB
/
ShowPageMakeCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Code16\Sharp\Console;
use Code16\Sharp\Console\Utils\WithModel;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputOption;
class ShowPageMakeCommand extends GeneratorCommand
{
use WithModel;
protected $name = 'sharp:make:show-page';
protected $description = 'Create a new Show Page class';
protected $type = 'SharpShow';
protected function buildClass($name)
{
$replace = [];
if ($this->option('model')) {
$replace = $this->buildModelReplacements($replace);
}
return str_replace(
array_keys($replace),
array_values($replace),
parent::buildClass($name),
);
}
protected function getStub()
{
return $this->option('model')
? __DIR__.'/stubs/show-page.model.stub'
: __DIR__.'/stubs/show-page.stub';
}
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\Sharp';
}
protected function getOptions()
{
return [
['model', 'm', InputOption::VALUE_REQUIRED, 'The model that the show displays'],
];
}
}