Skip to content

Commit

Permalink
fix when base path is app path
Browse files Browse the repository at this point in the history
  • Loading branch information
mvenghaus committed Mar 1, 2024
1 parent 34c3829 commit da2acab
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Console/MakeSettingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,17 @@ protected function getPath($name, $path): string

protected function getNamespace($path): string
{
$path = trim(str_replace([base_path(), '/'], ['', '\\'], $path), '\\');
$path = preg_replace(
[
'/^(' . preg_quote(base_path(), '/') . ')/',
'/\//'
],
[
'',
'\\'
],
$path
);

return implode('\\', array_map(fn ($directory) => ucfirst($directory), explode('\\', $path)));
}
Expand Down

0 comments on commit da2acab

Please sign in to comment.