From da2acab9a5701d1d7f6b6efde33dd8be30a4ac69 Mon Sep 17 00:00:00 2001 From: Marcus Date: Fri, 1 Mar 2024 13:41:26 +0100 Subject: [PATCH] fix when base path is app path --- src/Console/MakeSettingCommand.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Console/MakeSettingCommand.php b/src/Console/MakeSettingCommand.php index 2358040..549a4ca 100644 --- a/src/Console/MakeSettingCommand.php +++ b/src/Console/MakeSettingCommand.php @@ -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))); }