Skip to content

Commit dc38442

Browse files
committed
fixed component class view reference
1 parent a988b65 commit dc38442

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

src/Illuminate/Foundation/Console/ComponentMakeCommand.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ public function handle()
5353
*/
5454
protected function writeView()
5555
{
56-
$view = collect(explode('/', $this->argument('name')))
57-
->map(function ($part) {
58-
return Str::kebab($part);
59-
})
60-
->implode('.');
56+
$view = $this->getView();
6157

6258
$path = resource_path('views').'/'.str_replace('.', '/', 'components.'.$view);
6359

@@ -91,11 +87,25 @@ protected function buildClass($name)
9187

9288
return str_replace(
9389
'DummyView',
94-
'view(\'components.'.Str::kebab(class_basename($name)).'\')',
90+
'view(\'components.'.$this->getView().'\')',
9591
parent::buildClass($name)
9692
);
9793
}
9894

95+
/**
96+
* Gets the view path relative to the components dir.
97+
*
98+
* @return string view
99+
*/
100+
protected function getView()
101+
{
102+
return collect(explode('/', $this->argument('name')))
103+
->map(function ($part) {
104+
return Str::kebab($part);
105+
})
106+
->implode('.');
107+
}
108+
99109
/**
100110
* Get the stub file for the generator.
101111
*

0 commit comments

Comments
 (0)