diff --git a/src/Illuminate/Console/GeneratorCommand.php b/src/Illuminate/Console/GeneratorCommand.php index 798a9dc5e137..07913bd67eac 100644 --- a/src/Illuminate/Console/GeneratorCommand.php +++ b/src/Illuminate/Console/GeneratorCommand.php @@ -417,7 +417,13 @@ protected function sortImports($stub) */ protected function getNameInput() { - return (string) Str::of($this->argument('name'))->trim()->beforeLast('.php'); + $name = trim($this->argument('name')); + + if (Str::endsWith($name, '.php')) { + return Str::substr($name, 0, -4); + } + + return $name; } /**